! Given the following Structure: ! We can define a pointer to a structure. ! Now studentptr points to the s1 structure.

Size: px
Start display at page:

Download "! Given the following Structure: ! We can define a pointer to a structure. ! Now studentptr points to the s1 structure."

Transcription

1 Liked Lists Uit 5 Sectios 11.9 & CS 2308 Fall 2018 Jill Seama 11.9: Poiters to Structures! Give the followig Structure: struct Studet { strig ame; // Studet s ame it idnum; // Studet ID umber it credithours; // Credit hours erolled float ga; // Curret GPA ;! We ca defie a oiter to a structure Studet s1 = { Jae Doe, 12345, 15, 3.3; Studet *studetptr; studetptr = &s1;! Now studetptr oits to the s1 structure.!1!2 Poiters to Structures structure oiter oerator: ->! How to access a member through the oiter? Studet s1 = { Jae Doe, 12345, 15, 3.3; Studet *studetptr; studetptr = &s1; cout << *studetptr.ame << ed;! dot oerator has higher recedece tha the dereferecig oerator, so: *studetptr.ame is equivalet to! You must dereferece the oiter first: cout << (*studetptr).ame << ed; // ERROR studetptr is ot a structure! *(studetptr.ame) // WORKS!3! Due to the awkwardess of the oiter otatio, C rovides a oerator for dereferecig structure oiters: studetptr->ame! The structure oiter oerator is the hyhe (-) followed by the greater tha (>), like a arrow.! I summary: s1.ame is equivalet to // a member of structure s1 (*studetptr).ame str->ame // a member of the structure str oits to!4

2 cout << Name << ame1 << edl; Structure Poiter: examle! Fuctio to iut a studet, usig a tr to struct! Call: void iutstudet(studet *s) { cout << Eter Studet ame: ; getlie(ci,s->ame); cout << Eter studetid: ; ci >> s->idnum; cout << Eter credit hours: ; ci >> s->credithours; cout << Eter GPA: ; ci >> s->ga; Studet s1; iutstudet(&s1); cout << s1.ame << edl;... Or you could use a referece arameter. I m usig a oiter to give a examle of usig the -> sytax.!5 Dyamically Allocatig Structures! Structures ca be dyamically allocated with ew: Studet *str; str = ew Studet; str->ame = Jae Doe ; str->idnum = 12345;... delete str;! Arrays of structures ca also be dyamically allocated: Studet *str; str = ew Studet[100]; str[0].ame = Joh Deer ;... delete [] str; If a oiter oits to a array, you ca use square brackets with it, as if it were a array. Do ot use -> here.! Itroductio to Liked Lists! A data structure reresetig a list! A series of dyamically allocated odes chaied together i sequece - Each ode oits to oe other ode.! A searate oiter (the ) oits to the first item i the list.! The last elemet oits to ull (address 0) ull!7! Each ode cotais: Node Orgaizatio - data members cotai the elemets values. - a oiter that ca oit to aother ode data! We use a struct to defie the ode tye: struct ListNode { double value; ListNode *ext; ;! ext ca hold the address of a ListNode. - it ca also be ull oiter!8

3 Usig (or ulltr) Liked Lists: Tasks! Equivalet to address 0! Used to secify ed of the list! I C++11, you ca use ulltr istead of! is defied i the cstddef er.! to test a oiter for, these are equivalet: while (!= )... <==> while ()... if (==)... <==> if (!)...! Note: Do NOT dereferece a tr! We will imlemet the followig tasks o a liked list: T1: Create a emty list T2: Create a ew ode T3: Add a ew ode to frot of list (give ewnode) T4: Traverse the list (ad outut) T5: Fid the last ode (of a o-emty list) T6: Fid the ode cotaiig a certai value T7: Fid a ode AND it s revious eighbor. T8: Aed to the ed of a o-emty list T9: Delete the first ode T10: Delete a elemet, give ad ListNode * = ; cout << ->value; //crash! ull oiter excetio!9!10 T11: Isert a ew elemet, give ad T1:Create a emty list! let s make the emty list struct ListNode // the ode data tye { double value; // data ListNode *ext; // tr to ext ode ; T2:Create a ew ode:! let s make a ew ode: ListNode *ewnode = ew ListNode; ewnode->value = 1.2; ewnode->ext = ; it mai() { ListNode * = ; // the emty list! It s ot attached to the list yet. ewnode 1.2!11!12

4 T3:Add ew ode to frot of list:! make ewnode s ext oit to the first elemet.! the make oit to ewnode. ewnode ewnode->ext = ; = ewnode; 1.2 This works eve if is, try it. T4:Traverse the list (ad outut all the elemets)! let s outut a list of two elemets: cout << ->value << << ->ext->value << edl;! ow usig a temorary oiter to oit to each ode: ListNode *; //temorary oiter (do t use for this) = ; // oits to the first ode cout << ->value << ; = ->ext; //makes oit to the 2d ode (draw it!) cout << ->value << edl; = ->ext; //what does oit to ow?! ow let s rewrite that as a loo: ListNode *; = ; //temorary oiter (do t use for this) // oits to the first ode ewnode 1.2!13 while (!=) { cout << ->value << ; = ->ext; //makes oit to the ext ode!14 T5:Fid the last ode (of a o-emty list)! Goal: make a temorary oiter,, oit to the last ode i the list. T6:Fid the ode cotaiig a certai value! Goal: make a temorary oiter,, oit to the ode cotaiig 5.6. ull 5.6 ull! Make oit to the first ode. The: - do =->ext util oits to the last ode. - i the last ode, ext is ull. - so sto whe ->ext is ull. ListNode *=; // oits to what oits to while (->ext!=) { = ->ext; //makes oit to the ext ode!15! Make oit to the first ode. The: - do =->ext util oits to the ode with so sto whe ->value is 5.6. ListNode *=; // oits to what oits to while (->value!=5.6) { = ->ext; //makes oit to the ext ode!16

5 Fid the ode cotaiig a certai value, cotiued! What if 5.6 is ot i the list?! If 5.6 is ot i the list, the loo will ot sto. will evetually be, ad evaluatig ->value i the coditio will crash.! So let s make the loo sto if becomes. ListNode *=; ull // oits to what oits to while (!= && ->value!=5.6) { = ->ext; //makes oit to the ext ode!17 T7:Fid a ode AND it s revious eighbor.! sometimes we eed to track the curret ad the revious ode: ListNode * = ; //curret ode, set to first ode ListNode * = ; //revious ode, oe yet while (!= && ->value!=5.6) { = ; //save curret ode address = ->ext; //advace curret ode to ext oe ull!18 T8:Aed to the ed of a o-emty list! Create a ew ode, ad fid the last ode: T9:Delete the first ode of a o-emty list ull ListNode *ewnode = ew ListNode; ewnode->value = 3.3; ewnode->ext = ; ListNode *=; while (->ext!=) { = ->ext; We ve doe this already. ewnode 3.3 ull! delete the first elemet of a o-emty list = ->ext;! what about deallocatig the first ode? Oos. ListNode * = ; = ->ext; delete ;! Now make the last ode s ext oit to ewnode. ->ext = ewnode;!19!20

6 T10: Delete a elemet, give ad T11:Isert a ew elemet, give ad Deletig 13 from the list ->ext = ->ext; ad must ot be ull Isertig 17 ito the list ewnode 17 must ot be ull ->ext = ewnode; ewnode->ext = ; delete ; !21 ewnode!22 Exercise: fid four errors 18.2 List oeratios! it mai() { struct ode { it data; ode * ext; // create emty list ode * list; // isert six odes at frot of list ode *; for (it i=0;i<=5;i++) { = ew ode; ->data = i; ->ext = list;! Some basic oeratios over a list: - create a ew, emty list - aed a value to the ed of the list - isert a value withi the list - delete a value (remove it from the list) - dislay the values i the list // rit list = list; while (!) { cout << ->data << " "; = ->ext; cout << edl;!23 - delete/destroy the list (if it was dyamically allocated)!24

7 Declarig the List data tye NumberList class declaratio NumberList.h! We will be defiig a class called NumberList to rereset a List data tye. - ours will store values of tye double, usig a liked list.! The class will imlemet the basic oeratios over lists o the revious slide.! I the rivate sectio of the class we will: - defie a struct data tye for the odes - defie a oiter variable () that oits to the first ode i the list.!25! class NumberList { rivate: struct ListNode // the ode data tye { double value; // data ListNode *ext; // tr to ext ode ; ListNode *; // the list ; ublic: NumberList(); ~NumberList(); void aednode(double); void isertnode(double); void deletenode(double); void dislaylist(); // creates a emty list!26 Oeratio: Create the emty list Oeratio: aed ode to ed of list! Costructor: sets u emty list (This is T1, create a emty list). #iclude "NumberList.h" NumberList::NumberList() { = ; NumberList.c! aednode: adds ew ode to ed of list! Algorithm: Create a ew ode (T2) If the list is emty, Make oit to the ew ode. (T3) Else (T8) Fid the last ode i the list Make the last ode oit to the ew ode!27!28

8 void NumberList::aedNode(double um) { // Create a ew ode ad store the data i it (T2) ListNode *ewnode = ew ListNode; ewnode->value = um; ewnode->ext = ; // If emty, make oit to ew ode (T3) if (==) = ewnode; else { // Aed to ed of o-emty list (T8) ListNode * = ; // oits to first elemet // traverse list to fid last ode while (->ext) //it s ot last = ->ext; //make it t to ext // ow ts to last ode // make last ode oit to ewnode ->ext = ewnode; i NumberList.c!29 Driver to demo NumberList! ListDriver.c versio 1 (o outut) #iclude "NumberList.h" it mai() { // Defie the list NumberList list; // Aed some values to the list list.aednode(2.5); list.aednode(7.9); list.aednode(12.6); ListDriver.c!30 Traversig a Liked List Oeratio: dislay the list! Visit each ode i a liked list, to - dislay cotets, sum data, test data, etc.! Basic rocess (this is T4): set a oiter to oit to what oits to while the oiter is ot rocess data of curret ode go to the ext ode by settig the oiter to the ext field of the curret ode ed while!31 void NumberList::dislayList() { ListNode * = ; //start at the of the list // while ts to somethig (ot ), cotiue while () { //Dislay the value i the curret ode cout << ->value << ; //Move to the ext ode = ->ext; cout << edl; i NumberList.c!32

9 Driver to demo NumberList Oeratio: destroy a List! ListDriver.c versio 2 #iclude "NumberList.h" it mai() { ListDriver.c! The destructor must delete (deallocate) all odes used i the list! To do this, use list traversal to visit each ode! ~NumberList: what s wrog with this defiitio? // Defie the list NumberList list; NumberList::~NumberList() { // Aed some values to the list list.aednode(2.5); list.aednode(7.9); list.aednode(12.6); // Dislay the values i the list. list.dislaylist(); Outut: !33 ListNode *; // traversal tr = ; //start at of list while () { delete ; // delete curret = ->ext; // advace tr!34 destructor! You eed to save ->ext before deletig : NumberList::~NumberList() { ListNode *; // traversal tr i NumberList.c ListNode *; // saves the ext ode = ; //start at of list while () { = ->ext; // save the ext delete ; // delete curret = ; // advace tr!35 Oeratio: delete a ode from the list! deletenode: removes ode from list, ad deletes (deallocates) the removed ode.! This is T7 ad T10: - T7: Fid a ode AND it s revious eighbor (&) - the do T10: Delete a elemet, give ad Deletig 13 from the list!36

10 deletenode: what if or are ull?! If is ull, there is othig to delete:! If is ull, we eed to delete the first ode (T9):! Delete, accoutig for or beig ull: if (!==) { if (==) // delete the first ode = ->ext; else // ad are ot ->ext = ->ext; delete ; // sice was t, deallocate!37 //there is o else, if was, othig to remove deletenode code void NumberList::deleteNode(double um) { ListNode * = ; ListNode *; // to traverse the list // trailig ode oiter // ski odes ot equal to um, sto at last while ( && ->value!=um) { = ; // save it! = ->ext; // advace it i NumberList.c // ot ull: um was foud, set liks + delete if () { if (==) { // oits to the first elem. = ->ext; delete ; else { // oits to the redecessor ->ext = ->ext; delete ;!38 Driver to demo NumberList // set u the list NumberList list; list.aednode(2.5); list.aednode(7.9); list.aednode(12.6); list.dislaylist(); cout << edl << "remove 7.9:" << edl; list.deletenode(7.9); list.dislaylist(); cout << edl << "remove 8.9: " << edl; list.deletenode(8.9); list.dislaylist(); cout << edl << "remove 2.5: " << edl; list.deletenode(2.5); list.dislaylist(); i ListDriver.c Outut: remove 7.9: remove 8.9: remove 2.5: 12.6!39 Oeratio: isert a ode ito a liked list! Iserts a ew ode ito the middle of a list.! This is T7 ad T11: - T7: Fid a ode AND it s revious eighbor (&) we will make oit to the first elemet > 17 - the do T11: Isert a ew elemet, give ad ->ext = ewnode; ewnode->ext = ; 17!40 ewnode

11 cout << Name << ame1 << edl; isertnode: what if or are ull?! If is ull, it aeds to ed: ->ext = ewnode; ewnode->ext = ;! If is ull, we eed to add ode to frot (T3):! Isert, accoutig for beig ull: if (==) { // must be oitig to first ode = ewnode; ewnode->ext = ; else { // is ot ->ext = ewnode; ewnode->ext = ;!41 //if is ull, is oitig to the last ode, ad it works. Isertio Poit! Note that i the isertnode imlemetatio that follows, the isertio oit is immediately before the first ode i the list that has a value greater tha the value beig iserted.! This works very icely if the list is already sorted ad you wat to maitai the sort order.! Aother way to secify the isertio oit is to secify the ositio where the value should be iserted.! A third way to secify the isertio oit is to secify which elemet i the list the ew value!42 should be iserted before (or after). isertnode code void NumberList::isertNode(double um) { i NumberList.c ListNode *ewnode; // tr to ew ode ListNode *; // tr to traverse list ListNode *; // ode revious to //allocate ew ode ewnode = ew ListNode; ewnode->value = um; // ski all odes less tha um = ; while ( && ->value < um) { = ; // save = ->ext; // advace if ( == ) { = ewnode; ewnode->ext = ; else { ->ext = ewnode; ewnode->ext = ; //isert before first //isert after!43 Driver to demo NumberList it mai() { i ListDriver.c // set u the list NumberList list; list.aednode(2.5); list.aednode(7.9); list.aednode(12.6); list.dislaylist(); list.isertnode (8.5); list.dislaylist(); list.isertnode (1.5); list.dislaylist(); list.isertnode (21.5); list.dislaylist(); Outut: !44

! A data structure representing a list. ! A series of nodes chained together in sequence. ! A separate pointer (the head) points to the first

! A data structure representing a list. ! A series of nodes chained together in sequence. ! A separate pointer (the head) points to the first Ch. 17: Linked Lists 17.1 Introduction to Linked Lists! A data structure reresenting a list! A series of nodes chained together in sequence CS 2308 Sring 2015 Jill Seaman - Each node oints to one other

More information

Chapter 9. Pointers and Dynamic Arrays. Copyright 2015 Pearson Education, Ltd.. All rights reserved.

Chapter 9. Pointers and Dynamic Arrays. Copyright 2015 Pearson Education, Ltd.. All rights reserved. Chapter 9 Poiters ad Dyamic Arrays Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 9.1 Poiters 9.2 Dyamic Arrays Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Slide 9-3

More information

1/27/12. Vectors: Outline and Reading. Chapter 6: Vectors, Lists and Sequences. The Vector ADT. Applications of Vectors. Array based Vector: Insertion

1/27/12. Vectors: Outline and Reading. Chapter 6: Vectors, Lists and Sequences. The Vector ADT. Applications of Vectors. Array based Vector: Insertion Chater 6: ectors, Lists ad Sequeces ectors: Outlie ad Readig The ector ADT ( 6.1.1) Array-based imlemetatio ( 6.1.2) Nacy Amato Parasol Lab, Det. CSE, Texas A&M Uiversity Ackowledgemet: These slides are

More information

! A data structure representing a list. ! A series of nodes chained together in sequence. ! A separate pointer (the head) points to the first

! A data structure representing a list. ! A series of nodes chained together in sequence. ! A separate pointer (the head) points to the first Ch. 17: Linked Lists 17.1 Introduction to Linked Lists! A data structure representing a list! A series of nodes chained together in sequence CS 2308 Spring 2013 Jill Seaman - Each node points to one other

More information

Chapter 11. Friends, Overloaded Operators, and Arrays in Classes. Copyright 2014 Pearson Addison-Wesley. All rights reserved.

Chapter 11. Friends, Overloaded Operators, and Arrays in Classes. Copyright 2014 Pearson Addison-Wesley. All rights reserved. Chapter 11 Frieds, Overloaded Operators, ad Arrays i Classes Copyright 2014 Pearso Addiso-Wesley. All rights reserved. Overview 11.1 Fried Fuctios 11.2 Overloadig Operators 11.3 Arrays ad Classes 11.4

More information

Computer Science Foundation Exam. August 12, Computer Science. Section 1A. No Calculators! KEY. Solutions and Grading Criteria.

Computer Science Foundation Exam. August 12, Computer Science. Section 1A. No Calculators! KEY. Solutions and Grading Criteria. Computer Sciece Foudatio Exam August, 005 Computer Sciece Sectio A No Calculators! Name: SSN: KEY Solutios ad Gradig Criteria Score: 50 I this sectio of the exam, there are four (4) problems. You must

More information

Chapter 8. Strings and Vectors. Copyright 2014 Pearson Addison-Wesley. All rights reserved.

Chapter 8. Strings and Vectors. Copyright 2014 Pearson Addison-Wesley. All rights reserved. Chapter 8 Strigs ad Vectors Overview 8.1 A Array Type for Strigs 8.2 The Stadard strig Class 8.3 Vectors Slide 8-3 8.1 A Array Type for Strigs A Array Type for Strigs C-strigs ca be used to represet strigs

More information

CIS 121. Introduction to Trees

CIS 121. Introduction to Trees CIS 121 Itroductio to Trees 1 Tree ADT Tree defiitio q A tree is a set of odes which may be empty q If ot empty, the there is a distiguished ode r, called root ad zero or more o-empty subtrees T 1, T 2,

More information

Chapter 8. Strings and Vectors. Copyright 2015 Pearson Education, Ltd.. All rights reserved.

Chapter 8. Strings and Vectors. Copyright 2015 Pearson Education, Ltd.. All rights reserved. Chapter 8 Strigs ad Vectors Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 8.1 A Array Type for Strigs 8.2 The Stadard strig Class 8.3 Vectors Copyright 2015 Pearso Educatio, Ltd..

More information

! A data structure representing a list. ! A series of dynamically allocated nodes. ! A separate pointer (the head) points to the first

! A data structure representing a list. ! A series of dynamically allocated nodes. ! A separate pointer (the head) points to the first Linked Lists Introduction to Linked Lists A data structure representing a Week 8 Gaddis: Chapter 17 CS 5301 Spring 2014 Jill Seaman A series of dynamically allocated nodes chained together in sequence

More information

Linked Lists 11/16/18. Preliminaries. Java References. Objects and references. Self references. Linking self-referential nodes

Linked Lists 11/16/18. Preliminaries. Java References. Objects and references. Self references. Linking self-referential nodes Prelimiaries Liked Lists public class StrageObject { Strig ame; StrageObject other; Arrays are ot always the optimal data structure: A array has fixed size eeds to be copied to expad its capacity Addig

More information

. Written in factored form it is easy to see that the roots are 2, 2, i,

. Written in factored form it is easy to see that the roots are 2, 2, i, CMPS A Itroductio to Programmig Programmig Assigmet 4 I this assigmet you will write a java program that determies the real roots of a polyomial that lie withi a specified rage. Recall that the roots (or

More information

CS 11 C track: lecture 1

CS 11 C track: lecture 1 CS 11 C track: lecture 1 Prelimiaries Need a CMS cluster accout http://acctreq.cms.caltech.edu/cgi-bi/request.cgi Need to kow UNIX IMSS tutorial liked from track home page Track home page: http://courses.cms.caltech.edu/courses/cs11/material

More information

Recursion. Recursion. Mathematical induction: example. Recursion. The sum of the first n odd numbers is n 2 : Informal proof: Principle:

Recursion. Recursion. Mathematical induction: example. Recursion. The sum of the first n odd numbers is n 2 : Informal proof: Principle: Recursio Recursio Jordi Cortadella Departmet of Computer Sciece Priciple: Reduce a complex problem ito a simpler istace of the same problem Recursio Itroductio to Programmig Dept. CS, UPC 2 Mathematical

More information

CIS 121 Data Structures and Algorithms with Java Spring Stacks, Queues, and Heaps Monday, February 18 / Tuesday, February 19

CIS 121 Data Structures and Algorithms with Java Spring Stacks, Queues, and Heaps Monday, February 18 / Tuesday, February 19 CIS Data Structures ad Algorithms with Java Sprig 09 Stacks, Queues, ad Heaps Moday, February 8 / Tuesday, February 9 Stacks ad Queues Recall the stack ad queue ADTs (abstract data types from lecture.

More information

CIS 121 Data Structures and Algorithms with Java Spring Stacks and Queues Monday, February 12 / Tuesday, February 13

CIS 121 Data Structures and Algorithms with Java Spring Stacks and Queues Monday, February 12 / Tuesday, February 13 CIS Data Structures ad Algorithms with Java Sprig 08 Stacks ad Queues Moday, February / Tuesday, February Learig Goals Durig this lab, you will: Review stacks ad queues. Lear amortized ruig time aalysis

More information

Computers and Scientific Thinking

Computers and Scientific Thinking Computers ad Scietific Thikig David Reed, Creighto Uiversity Chapter 15 JavaScript Strigs 1 Strigs as Objects so far, your iteractive Web pages have maipulated strigs i simple ways use text box to iput

More information

! A data type for which: ! An ADT may be implemented using various. ! Examples:

! A data type for which: ! An ADT may be implemented using various. ! Examples: List ADT: Linked lists vs. Arrays CS 2308 Fall 2018 Jill Seaman Abstract Data Type! A data type for which: - only the properties of the data and the operations to be performed on the data are specific,

More information

Chapter 10. Defining Classes. Copyright 2015 Pearson Education, Ltd.. All rights reserved.

Chapter 10. Defining Classes. Copyright 2015 Pearson Education, Ltd.. All rights reserved. Chapter 10 Defiig Classes Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 10.1 Structures 10.2 Classes 10.3 Abstract Data Types 10.4 Itroductio to Iheritace Copyright 2015 Pearso Educatio,

More information

Ch. 17: Linked Lists. Introduction to Linked Lists

Ch. 17: Linked Lists. Introduction to Linked Lists Ch. 17: Linked Lists Part 1 CS 2308 Fall 2011 Jill Seaman Lecture 16 Using content from textbook slides: Starting Out with C++, Gaddis, Pearson/Addison-Wesley 1 Introduction to Linked Lists A data structure

More information

6.854J / J Advanced Algorithms Fall 2008

6.854J / J Advanced Algorithms Fall 2008 MIT OpeCourseWare http://ocw.mit.edu 6.854J / 18.415J Advaced Algorithms Fall 2008 For iformatio about citig these materials or our Terms of Use, visit: http://ocw.mit.edu/terms. 18.415/6.854 Advaced Algorithms

More information

CMPT 125 Assignment 2 Solutions

CMPT 125 Assignment 2 Solutions CMPT 25 Assigmet 2 Solutios Questio (20 marks total) a) Let s cosider a iteger array of size 0. (0 marks, each part is 2 marks) it a[0]; I. How would you assig a poiter, called pa, to store the address

More information

The number n of subintervals times the length h of subintervals gives length of interval (b-a).

The number n of subintervals times the length h of subintervals gives length of interval (b-a). Simulator with MadMath Kit: Riema Sums (Teacher s pages) I your kit: 1. GeoGebra file: Ready-to-use projector sized simulator: RiemaSumMM.ggb 2. RiemaSumMM.pdf (this file) ad RiemaSumMMEd.pdf (educator's

More information

Guide to Applying Online

Guide to Applying Online Guide to Applyig Olie Itroductio Respodig to requests for additioal iformatio Reportig: submittig your moitorig or ed of grat Pledges: submittig your Itroductio This guide is to help charities submit their

More information

Chapter 5. Functions for All Subtasks. Copyright 2015 Pearson Education, Ltd.. All rights reserved.

Chapter 5. Functions for All Subtasks. Copyright 2015 Pearson Education, Ltd.. All rights reserved. Chapter 5 Fuctios for All Subtasks Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 5.1 void Fuctios 5.2 Call-By-Referece Parameters 5.3 Usig Procedural Abstractio 5.4 Testig ad Debuggig

More information

Chapter 4 The Datapath

Chapter 4 The Datapath The Ageda Chapter 4 The Datapath Based o slides McGraw-Hill Additioal material 24/25/26 Lewis/Marti Additioal material 28 Roth Additioal material 2 Taylor Additioal material 2 Farmer Tae the elemets that

More information

University of Waterloo Department of Electrical and Computer Engineering ECE 250 Algorithms and Data Structures

University of Waterloo Department of Electrical and Computer Engineering ECE 250 Algorithms and Data Structures Uiversity of Waterloo Departmet of Electrical ad Computer Egieerig ECE 250 Algorithms ad Data Structures Midterm Examiatio ( pages) Istructor: Douglas Harder February 7, 2004 7:30-9:00 Name (last, first)

More information

Homework 1 Solutions MA 522 Fall 2017

Homework 1 Solutions MA 522 Fall 2017 Homework 1 Solutios MA 5 Fall 017 1. Cosider the searchig problem: Iput A sequece of umbers A = [a 1,..., a ] ad a value v. Output A idex i such that v = A[i] or the special value NIL if v does ot appear

More information

CS211 Fall 2003 Prelim 2 Solutions and Grading Guide

CS211 Fall 2003 Prelim 2 Solutions and Grading Guide CS11 Fall 003 Prelim Solutios ad Gradig Guide Problem 1: (a) obj = obj1; ILLEGAL because type of referece must always be a supertype of type of object (b) obj3 = obj1; ILLEGAL because type of referece

More information

CSC 220: Computer Organization Unit 11 Basic Computer Organization and Design

CSC 220: Computer Organization Unit 11 Basic Computer Organization and Design College of Computer ad Iformatio Scieces Departmet of Computer Sciece CSC 220: Computer Orgaizatio Uit 11 Basic Computer Orgaizatio ad Desig 1 For the rest of the semester, we ll focus o computer architecture:

More information

Lecture 1: Introduction and Strassen s Algorithm

Lecture 1: Introduction and Strassen s Algorithm 5-750: Graduate Algorithms Jauary 7, 08 Lecture : Itroductio ad Strasse s Algorithm Lecturer: Gary Miller Scribe: Robert Parker Itroductio Machie models I this class, we will primarily use the Radom Access

More information

Location Steps and Paths

Location Steps and Paths Locatio Steps ad Paths 3 INTHIS CHAPTER Uderstadig Locatio Steps ad Paths How do locatio paths work? We took a look at locatio paths i the overview i Chapter 1, where we saw that locatio paths look much

More information

Basic allocator mechanisms The course that gives CMU its Zip! Memory Management II: Dynamic Storage Allocation Mar 6, 2000.

Basic allocator mechanisms The course that gives CMU its Zip! Memory Management II: Dynamic Storage Allocation Mar 6, 2000. 5-23 The course that gives CM its Zip Memory Maagemet II: Dyamic Storage Allocatio Mar 6, 2000 Topics Segregated lists Buddy system Garbage collectio Mark ad Sweep Copyig eferece coutig Basic allocator

More information

ECE4050 Data Structures and Algorithms. Lecture 6: Searching

ECE4050 Data Structures and Algorithms. Lecture 6: Searching ECE4050 Data Structures ad Algorithms Lecture 6: Searchig 1 Search Give: Distict keys k 1, k 2,, k ad collectio L of records of the form (k 1, I 1 ), (k 2, I 2 ),, (k, I ) where I j is the iformatio associated

More information

Overview. Chapter 18 Vectors and Arrays. Reminder. vector. Bjarne Stroustrup

Overview. Chapter 18 Vectors and Arrays. Reminder. vector. Bjarne Stroustrup Chapter 18 Vectors ad Arrays Bjare Stroustrup Vector revisited How are they implemeted? Poiters ad free store Destructors Iitializatio Copy ad move Arrays Array ad poiter problems Chagig size Templates

More information

COSC 1P03. Ch 7 Recursion. Introduction to Data Structures 8.1

COSC 1P03. Ch 7 Recursion. Introduction to Data Structures 8.1 COSC 1P03 Ch 7 Recursio Itroductio to Data Structures 8.1 COSC 1P03 Recursio Recursio I Mathematics factorial Fiboacci umbers defie ifiite set with fiite defiitio I Computer Sciece sytax rules fiite defiitio,

More information

Classes and Objects. Again: Distance between points within the first quadrant. José Valente de Oliveira 4-1

Classes and Objects. Again: Distance between points within the first quadrant. José Valente de Oliveira 4-1 Classes ad Objects jvo@ualg.pt José Valete de Oliveira 4-1 Agai: Distace betwee poits withi the first quadrat Sample iput Sample output 1 1 3 4 2 jvo@ualg.pt José Valete de Oliveira 4-2 1 The simplest

More information

Lecture 28: Data Link Layer

Lecture 28: Data Link Layer Automatic Repeat Request (ARQ) 2. Go ack N ARQ Although the Stop ad Wait ARQ is very simple, you ca easily show that it has very the low efficiecy. The low efficiecy comes from the fact that the trasmittig

More information

CSE 417: Algorithms and Computational Complexity

CSE 417: Algorithms and Computational Complexity Time CSE 47: Algorithms ad Computatioal Readig assigmet Read Chapter of The ALGORITHM Desig Maual Aalysis & Sortig Autum 00 Paul Beame aalysis Problem size Worst-case complexity: max # steps algorithm

More information

Priority Queues. Binary Heaps

Priority Queues. Binary Heaps Priority Queues Biary Heaps Priority Queues Priority: some property of a object that allows it to be prioritized with respect to other objects of the same type Mi Priority Queue: homogeeous collectio of

More information

Weston Anniversary Fund

Weston Anniversary Fund Westo Olie Applicatio Guide 2018 1 This guide is desiged to help charities applyig to the Westo to use our olie applicatio form. The Westo is ope to applicatios from 5th Jauary 2018 ad closes o 30th Jue

More information

CS 111: Program Design I Lecture # 7: First Loop, Web Crawler, Functions

CS 111: Program Design I Lecture # 7: First Loop, Web Crawler, Functions CS 111: Program Desig I Lecture # 7: First Loop, Web Crawler, Fuctios Robert H. Sloa & Richard Warer Uiversity of Illiois at Chicago September 18, 2018 What will this prit? x = 5 if x == 3: prit("hi!")

More information

CHAPTER IV: GRAPH THEORY. Section 1: Introduction to Graphs

CHAPTER IV: GRAPH THEORY. Section 1: Introduction to Graphs CHAPTER IV: GRAPH THEORY Sectio : Itroductio to Graphs Sice this class is called Number-Theoretic ad Discrete Structures, it would be a crime to oly focus o umber theory regardless how woderful those topics

More information

Sorting in Linear Time. Data Structures and Algorithms Andrei Bulatov

Sorting in Linear Time. Data Structures and Algorithms Andrei Bulatov Sortig i Liear Time Data Structures ad Algorithms Adrei Bulatov Algorithms Sortig i Liear Time 7-2 Compariso Sorts The oly test that all the algorithms we have cosidered so far is compariso The oly iformatio

More information

Linked Lists. Linked list: a collection of items (nodes) containing two components: Data Address (link) of the next node in the list

Linked Lists. Linked list: a collection of items (nodes) containing two components: Data Address (link) of the next node in the list Linked Lists Introduction : Data can be organized and processed sequentially using an array, called a sequential list Problems with an array Array size is fixed Unsorted array: searching for an item is

More information

n Some thoughts on software development n The idea of a calculator n Using a grammar n Expression evaluation n Program organization n Analysis

n Some thoughts on software development n The idea of a calculator n Using a grammar n Expression evaluation n Program organization n Analysis Overview Chapter 6 Writig a Program Bjare Stroustrup Some thoughts o software developmet The idea of a calculator Usig a grammar Expressio evaluatio Program orgaizatio www.stroustrup.com/programmig 3 Buildig

More information

Linked Lists. Linked list: a collection of items (nodes) containing two components: Data Address (link) of the next node in the list

Linked Lists. Linked list: a collection of items (nodes) containing two components: Data Address (link) of the next node in the list Linked Lists Introduction : Data can be organized and processed sequentially using an array, called a sequential list Problems with an array Array size is fixed Unsorted array: searching for an item is

More information

Chapter 6. I/O Streams as an Introduction to Objects and Classes. Copyright 2014 Pearson Addison-Wesley. All rights reserved.

Chapter 6. I/O Streams as an Introduction to Objects and Classes. Copyright 2014 Pearson Addison-Wesley. All rights reserved. Chapter 6 I/O Streams as a Itroductio to Objects ad Classes Overview 6.1 Streams ad Basic File I/O 6.2 Tools for Stream I/O 6.3 Character I/O Slide 6-3 6.1 Streams ad Basic File I/O I/O Streams I/O refers

More information

Chapter 4. Procedural Abstraction and Functions That Return a Value. Copyright 2015 Pearson Education, Ltd.. All rights reserved.

Chapter 4. Procedural Abstraction and Functions That Return a Value. Copyright 2015 Pearson Education, Ltd.. All rights reserved. Chapter 4 Procedural Abstractio ad Fuctios That Retur a Value Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 4.1 Top-Dow Desig 4.2 Predefied Fuctios 4.3 Programmer-Defied Fuctios 4.4

More information

Chapter 1. Introduction to Computers and C++ Programming. Copyright 2015 Pearson Education, Ltd.. All rights reserved.

Chapter 1. Introduction to Computers and C++ Programming. Copyright 2015 Pearson Education, Ltd.. All rights reserved. Chapter 1 Itroductio to Computers ad C++ Programmig Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 1.1 Computer Systems 1.2 Programmig ad Problem Solvig 1.3 Itroductio to C++ 1.4 Testig

More information

Chapter 2. C++ Basics. Copyright 2015 Pearson Education, Ltd.. All rights reserved.

Chapter 2. C++ Basics. Copyright 2015 Pearson Education, Ltd.. All rights reserved. Chapter 2 C++ Basics Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 2.1 Variables ad Assigmets 2.2 Iput ad Output 2.3 Data Types ad Expressios 2.4 Simple Flow of Cotrol 2.5 Program

More information

Pattern Recognition Systems Lab 1 Least Mean Squares

Pattern Recognition Systems Lab 1 Least Mean Squares Patter Recogitio Systems Lab 1 Least Mea Squares 1. Objectives This laboratory work itroduces the OpeCV-based framework used throughout the course. I this assigmet a lie is fitted to a set of poits usig

More information

Graphs. Minimum Spanning Trees. Slides by Rose Hoberman (CMU)

Graphs. Minimum Spanning Trees. Slides by Rose Hoberman (CMU) Graphs Miimum Spaig Trees Slides by Rose Hoberma (CMU) Problem: Layig Telephoe Wire Cetral office 2 Wirig: Naïve Approach Cetral office Expesive! 3 Wirig: Better Approach Cetral office Miimize the total

More information

Alpha Individual Solutions MAΘ National Convention 2013

Alpha Individual Solutions MAΘ National Convention 2013 Alpha Idividual Solutios MAΘ Natioal Covetio 0 Aswers:. D. A. C 4. D 5. C 6. B 7. A 8. C 9. D 0. B. B. A. D 4. C 5. A 6. C 7. B 8. A 9. A 0. C. E. B. D 4. C 5. A 6. D 7. B 8. C 9. D 0. B TB. 570 TB. 5

More information

MR-2010I %MktBSize Macro 989. %MktBSize Macro

MR-2010I %MktBSize Macro 989. %MktBSize Macro MR-2010I %MktBSize Macro 989 %MktBSize Macro The %MktBSize autocall macro suggests sizes for balaced icomplete block desigs (BIBDs). The sizes that it reports are sizes that meet ecessary but ot sufficiet

More information

Array Applications. Sorting. Want to put the contents of an array in order. Selection Sort Bubble Sort Insertion Sort. Quicksort Quickersort

Array Applications. Sorting. Want to put the contents of an array in order. Selection Sort Bubble Sort Insertion Sort. Quicksort Quickersort Sortig Wat to put the cotets of a arra i order Selectio Sort Bubble Sort Isertio Sort Quicksort Quickersort 2 tj Bubble Sort - coceptual Sort a arra of umbers ito ascedig or descedig order Split the list

More information

Greedy Algorithms. Interval Scheduling. Greedy Algorithms. Interval scheduling. Greedy Algorithms. Interval Scheduling

Greedy Algorithms. Interval Scheduling. Greedy Algorithms. Interval scheduling. Greedy Algorithms. Interval Scheduling Greedy Algorithms Greedy Algorithms Witer Paul Beame Hard to defie exactly but ca give geeral properties Solutio is built i small steps Decisios o how to build the solutio are made to maximize some criterio

More information

Algorithm Design Techniques. Divide and conquer Problem

Algorithm Design Techniques. Divide and conquer Problem Algorithm Desig Techiques Divide ad coquer Problem Divide ad Coquer Algorithms Divide ad Coquer algorithm desig works o the priciple of dividig the give problem ito smaller sub problems which are similar

More information

Overview. Common tasks. Observation. Chapter 20 The STL (containers, iterators, and algorithms) 8/13/18. Bjarne Stroustrup

Overview. Common tasks. Observation. Chapter 20 The STL (containers, iterators, and algorithms) 8/13/18. Bjarne Stroustrup Overview Chapter 20 The STL (cotaiers, iterators, ad algorithms) Bjare Stroustrup www.stroustrup.com/programmig Commo tasks ad ideals Geeric programmig Cotaiers, algorithms, ad iterators The simplest algorithm:

More information

9.1. Sequences and Series. Sequences. What you should learn. Why you should learn it. Definition of Sequence

9.1. Sequences and Series. Sequences. What you should learn. Why you should learn it. Definition of Sequence _9.qxd // : AM Page Chapter 9 Sequeces, Series, ad Probability 9. Sequeces ad Series What you should lear Use sequece otatio to write the terms of sequeces. Use factorial otatio. Use summatio otatio to

More information

condition w i B i S maximum u i

condition w i B i S maximum u i ecture 10 Dyamic Programmig 10.1 Kapsack Problem November 1, 2004 ecturer: Kamal Jai Notes: Tobias Holgers We are give a set of items U = {a 1, a 2,..., a }. Each item has a weight w i Z + ad a utility

More information

Chapter 3. More Flow of Control. Copyright 2015 Pearson Education, Ltd.. All rights reserved.

Chapter 3. More Flow of Control. Copyright 2015 Pearson Education, Ltd.. All rights reserved. Chapter 3 More Flow of Cotrol Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 3.1 Usig Boolea Expressios 3.2 Multiway Braches 3.3 More about C++ Loop Statemets 3.4 Desigig Loops Copyright

More information

Exercise 6 (Week 42) For the foreign students only.

Exercise 6 (Week 42) For the foreign students only. These are the last exercises of the course. Please, remember that to pass exercises, the sum of the poits gathered by solvig the questios ad attedig the exercise groups must be at least 4% ( poits) of

More information

Solution printed. Do not start the test until instructed to do so! CS 2604 Data Structures Midterm Spring, Instructions:

Solution printed. Do not start the test until instructed to do so! CS 2604 Data Structures Midterm Spring, Instructions: CS 604 Data Structures Midterm Sprig, 00 VIRG INIA POLYTECHNIC INSTITUTE AND STATE U T PROSI M UNI VERSI TY Istructios: Prit your ame i the space provided below. This examiatio is closed book ad closed

More information

The Implementation of Data Structures in Version 5 of Icon* Ralph E. Gr is wo Id TR 85-8

The Implementation of Data Structures in Version 5 of Icon* Ralph E. Gr is wo Id TR 85-8 The Implemetatio of Data Structures i Versio 5 of Ico* Ralph E. Gr is wo Id TR 85-8 April 1, 1985 Departmet of Computer Sciece The Uiversity of Arizoa Tucso. Arizoa 85721 This work was supported by the

More information

Ones Assignment Method for Solving Traveling Salesman Problem

Ones Assignment Method for Solving Traveling Salesman Problem Joural of mathematics ad computer sciece 0 (0), 58-65 Oes Assigmet Method for Solvig Travelig Salesma Problem Hadi Basirzadeh Departmet of Mathematics, Shahid Chamra Uiversity, Ahvaz, Ira Article history:

More information

What is the difference between a statistician and a mortician? Nobody's dying to see the statistician! Chapter 8 Interval Estimation

What is the difference between a statistician and a mortician? Nobody's dying to see the statistician! Chapter 8 Interval Estimation Slides Preared by JOHN S. LOUCKS St. Edward s Uiversity Slide 1 What is the differece betwee a statisticia ad a morticia? Nobody's dyig to see the statisticia! Slide Chater 8 Iterval Estimatio Poulatio

More information

Python Programming: An Introduction to Computer Science

Python Programming: An Introduction to Computer Science Pytho Programmig: A Itroductio to Computer Sciece Chapter 6 Defiig Fuctios Pytho Programmig, 2/e 1 Objectives To uderstad why programmers divide programs up ito sets of cooperatig fuctios. To be able to

More information

Recursion. Computer Science S-111 Harvard University David G. Sullivan, Ph.D. Review: Method Frames

Recursion. Computer Science S-111 Harvard University David G. Sullivan, Ph.D. Review: Method Frames Uit 4, Part 3 Recursio Computer Sciece S-111 Harvard Uiversity David G. Sulliva, Ph.D. Review: Method Frames Whe you make a method call, the Java rutime sets aside a block of memory kow as the frame of

More information

CS 111: Program Design I Lecture 21: Network Analysis. Robert H. Sloan & Richard Warner University of Illinois at Chicago April 10, 2018

CS 111: Program Design I Lecture 21: Network Analysis. Robert H. Sloan & Richard Warner University of Illinois at Chicago April 10, 2018 CS 111: Program Desig I Lecture 21: Network Aalysis Robert H. Sloa & Richard Warer Uiversity of Illiois at Chicago April 10, 2018 NETWORK ANALYSIS Which displays a graph i the sese of graph/etwork aalysis?

More information

15-859E: Advanced Algorithms CMU, Spring 2015 Lecture #2: Randomized MST and MST Verification January 14, 2015

15-859E: Advanced Algorithms CMU, Spring 2015 Lecture #2: Randomized MST and MST Verification January 14, 2015 15-859E: Advaced Algorithms CMU, Sprig 2015 Lecture #2: Radomized MST ad MST Verificatio Jauary 14, 2015 Lecturer: Aupam Gupta Scribe: Yu Zhao 1 Prelimiaries I this lecture we are talkig about two cotets:

More information

CS Polygon Scan Conversion. Slide 1

CS Polygon Scan Conversion. Slide 1 CS 112 - Polygo Sca Coversio Slide 1 Polygo Classificatio Covex All iterior agles are less tha 180 degrees Cocave Iterior agles ca be greater tha 180 degrees Degeerate polygos If all vertices are colliear

More information

High-Order Language APPLICATION LEVEL HIGH-ORDER LANGUAGE LEVEL ASSEMBLY LEVEL OPERATING SYSTEM LEVEL INSTRUCTION SET ARCHITECTURE LEVEL

High-Order Language APPLICATION LEVEL HIGH-ORDER LANGUAGE LEVEL ASSEMBLY LEVEL OPERATING SYSTEM LEVEL INSTRUCTION SET ARCHITECTURE LEVEL Chapter 2 C High-Order Laguage APPLICATION LEVEL HIGH-ORDER LANGUAGE LEVEL 6 ASSEMBLY LEVEL OPERATING SYSTEM LEVEL INSTRUCTION SET ARCHITECTURE LEVEL MICROCODE LEVEL LOGIC GATE LEVEL Figure 2. 7 6 5 4

More information

Lecture 18. Optimization in n dimensions

Lecture 18. Optimization in n dimensions Lecture 8 Optimizatio i dimesios Itroductio We ow cosider the problem of miimizig a sigle scalar fuctio of variables, f x, where x=[ x, x,, x ]T. The D case ca be visualized as fidig the lowest poit of

More information

Package RcppRoll. December 22, 2014

Package RcppRoll. December 22, 2014 Type Package Package RcppRoll December 22, 2014 Title Fast rollig fuctios through Rcpp ad RcppArmadillo Versio 0.1.0 Date 2013-01-10 Author Kevi Ushey Maitaier Kevi Ushey RcppRoll

More information

FURTHER INTEGRATION TECHNIQUES (TRIG, LOG, EXP FUNCTIONS)

FURTHER INTEGRATION TECHNIQUES (TRIG, LOG, EXP FUNCTIONS) Mathematics Revisio Guides More Trigoometric ad Log Itegrals Page of 7 MK HOME TUITION Mathematics Revisio Guides Level: AS / A Level AQA : C Edexcel: C OCR: C OCR MEI: C FURTHER INTEGRATION TECHNIQUES

More information

Examples and Applications of Binary Search

Examples and Applications of Binary Search Toy Gog ITEE Uiersity of Queeslad I the secod lecture last week we studied the biary search algorithm that soles the problem of determiig if a particular alue appears i a sorted list of iteger or ot. We

More information

OCR Statistics 1. Working with data. Section 3: Measures of spread

OCR Statistics 1. Working with data. Section 3: Measures of spread Notes ad Eamples OCR Statistics 1 Workig with data Sectio 3: Measures of spread Just as there are several differet measures of cetral tedec (averages), there are a variet of statistical measures of spread.

More information

BST Sequence of Operations

BST Sequence of Operations Splay Trees Problems with BSTs Because the shape of a BST is determied by the order that data is iserted, we ru the risk of trees that are essetially lists 12 21 20 32 24 37 15 40 55 56 77 2 BST Sequece

More information

CS200: Hash Tables. Prichard Ch CS200 - Hash Tables 1

CS200: Hash Tables. Prichard Ch CS200 - Hash Tables 1 CS200: Hash Tables Prichard Ch. 13.2 CS200 - Hash Tables 1 Table Implemetatios: average cases Search Add Remove Sorted array-based Usorted array-based Balaced Search Trees O(log ) O() O() O() O(1) O()

More information

Recursive Procedures. How can you model the relationship between consecutive terms of a sequence?

Recursive Procedures. How can you model the relationship between consecutive terms of a sequence? 6. Recursive Procedures I Sectio 6.1, you used fuctio otatio to write a explicit formula to determie the value of ay term i a Sometimes it is easier to calculate oe term i a sequece usig the previous terms.

More information

CIS 121 Data Structures and Algorithms with Java Fall Big-Oh Notation Tuesday, September 5 (Make-up Friday, September 8)

CIS 121 Data Structures and Algorithms with Java Fall Big-Oh Notation Tuesday, September 5 (Make-up Friday, September 8) CIS 11 Data Structures ad Algorithms with Java Fall 017 Big-Oh Notatio Tuesday, September 5 (Make-up Friday, September 8) Learig Goals Review Big-Oh ad lear big/small omega/theta otatios Practice solvig

More information

A Taste of Maya. Character Setup

A Taste of Maya. Character Setup This tutorial goes through the steps to add aimatio cotrols to a previously modeled character. The character i the scee below is wearig clothes made with Cloth ad the sceery has bee created with Pait Effects.

More information

Spanning Maximal Planar Subgraphs of Random Graphs

Spanning Maximal Planar Subgraphs of Random Graphs Spaig Maximal Plaar Subgraphs of Radom Graphs 6. Bollobiis* Departmet of Mathematics, Louisiaa State Uiversity, Bato Rouge, LA 70803 A. M. Frieze? Departmet of Mathematics, Caregie-Mello Uiversity, Pittsburgh,

More information

Lecture Notes 6 Introduction to algorithm analysis CSS 501 Data Structures and Object-Oriented Programming

Lecture Notes 6 Introduction to algorithm analysis CSS 501 Data Structures and Object-Oriented Programming Lecture Notes 6 Itroductio to algorithm aalysis CSS 501 Data Structures ad Object-Orieted Programmig Readig for this lecture: Carrao, Chapter 10 To be covered i this lecture: Itroductio to algorithm aalysis

More information

Avid Interplay Bundle

Avid Interplay Bundle Avid Iterplay Budle Versio 2.5 Cofigurator ReadMe Overview This documet provides a overview of Iterplay Budle v2.5 ad describes how to ru the Iterplay Budle cofiguratio tool. Iterplay Budle v2.5 refers

More information

Major CSL Write your name and entry no on every sheet of the answer script. Time 2 Hrs Max Marks 70

Major CSL Write your name and entry no on every sheet of the answer script. Time 2 Hrs Max Marks 70 NOTE:. Attempt all seve questios. Major CSL 02 2. Write your ame ad etry o o every sheet of the aswer script. Time 2 Hrs Max Marks 70 Q No Q Q 2 Q 3 Q 4 Q 5 Q 6 Q 7 Total MM 6 2 4 0 8 4 6 70 Q. Write a

More information

Lower Bounds for Sorting

Lower Bounds for Sorting Liear Sortig Topics Covered: Lower Bouds for Sortig Coutig Sort Radix Sort Bucket Sort Lower Bouds for Sortig Compariso vs. o-compariso sortig Decisio tree model Worst case lower boud Compariso Sortig

More information

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe CHAPTER 26 Ehaced Data Models: Itroductio to Active, Temporal, Spatial, Multimedia, ad Deductive Databases Copyright 2016 Ramez Elmasri ad Shamkat B.

More information

islerp: An Incremental Approach to Slerp

islerp: An Incremental Approach to Slerp isler: A Icremetal Aroach to Sler Xi Li Comuter Sciece Deartmet Digie Istitute of Techology xli@digie.edu Abstract I this aer, a icremetal uaterio iterolatio algorithm is itroduced. With the assumtio of

More information

top() Applications of Stacks

top() Applications of Stacks CS22 Algorithms ad Data Structures MW :00 am - 2: pm, MSEC 0 Istructor: Xiao Qi Lecture 6: Stacks ad Queues Aoucemets Quiz results Homework 2 is available Due o September 29 th, 2004 www.cs.mt.edu~xqicoursescs22

More information

Heaps. Presentation for use with the textbook Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015

Heaps. Presentation for use with the textbook Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015 Presetatio for use with the textbook Algorithm Desig ad Applicatios, by M. T. Goodrich ad R. Tamassia, Wiley, 201 Heaps 201 Goodrich ad Tamassia xkcd. http://xkcd.com/83/. Tree. Used with permissio uder

More information

BAAN IVc/BaanERP. Conversion Guide Oracle7 to Oracle8

BAAN IVc/BaanERP. Conversion Guide Oracle7 to Oracle8 BAAN IVc/BaaERP A publicatio of: Baa Developmet B.V. P.O.Box 143 3770 AC Bareveld The Netherlads Prited i the Netherlads Baa Developmet B.V. 1999. All rights reserved. The iformatio i this documet is subject

More information

n Maurice Wilkes, 1949 n Organize software to minimize errors. n Eliminate most of the errors we made anyway.

n Maurice Wilkes, 1949 n Organize software to minimize errors. n Eliminate most of the errors we made anyway. Bjare Stroustrup www.stroustrup.com/programmig Chapter 5 Errors Abstract Whe we program, we have to deal with errors. Our most basic aim is correctess, but we must deal with icomplete problem specificatios,

More information

Hash Tables. Presentation for use with the textbook Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015.

Hash Tables. Presentation for use with the textbook Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015. Presetatio for use with the textbook Algorithm Desig ad Applicatios, by M. T. Goodrich ad R. Tamassia, Wiley, 2015 Hash Tables xkcd. http://xkcd.com/221/. Radom Number. Used with permissio uder Creative

More information

The Magma Database file formats

The Magma Database file formats The Magma Database file formats Adrew Gaylard, Bret Pikey, ad Mart-Mari Breedt Johaesburg, South Africa 15th May 2006 1 Summary Magma is a ope-source object database created by Chris Muller, of Kasas City,

More information

CSI 3140 WWW Structures, Techniques and Standards. Cascading Style Sheets (CSS)

CSI 3140 WWW Structures, Techniques and Standards. Cascading Style Sheets (CSS) CSI 3140 WWW Structures, Techiques ad Stadards Cascadig Style Sheets (CSS) Motivatio whtml markup ca be used to represet Sematics: h1 meas that a elemet is a top-level headig Presetatio: h1 elemets look

More information

COP4020 Programming Languages. Functional Programming Prof. Robert van Engelen

COP4020 Programming Languages. Functional Programming Prof. Robert van Engelen COP4020 Programmig Laguages Fuctioal Programmig Prof. Robert va Egele Overview What is fuctioal programmig? Historical origis of fuctioal programmig Fuctioal programmig today Cocepts of fuctioal programmig

More information

NTH, GEOMETRIC, AND TELESCOPING TEST

NTH, GEOMETRIC, AND TELESCOPING TEST NTH, GEOMETRIC, AND TELESCOPING TEST Sectio 9. Calculus BC AP/Dual, Revised 08 viet.dag@humbleisd.et /4/08 0:0 PM 9.: th, Geometric, ad Telescopig Test SUMMARY OF TESTS FOR SERIES Lookig at the first few

More information

Project 2.5 Improved Euler Implementation

Project 2.5 Improved Euler Implementation Project 2.5 Improved Euler Implemetatio Figure 2.5.10 i the text lists TI-85 ad BASIC programs implemetig the improved Euler method to approximate the solutio of the iitial value problem dy dx = x+ y,

More information