Tutor Tues Apr 2, 2-4 PM since no classes Apr 1 Set 6 due Apr 9 Set 7 due April 11 C-3 due April 18.
CSE 250 February 16 - 20, 2009. Announcements 2/16 – In-lab Exercise 3 due 3/4 - Exam 2 Data...
-
Upload
corey-goodwin -
Category
Documents
-
view
214 -
download
1
Transcript of CSE 250 February 16 - 20, 2009. Announcements 2/16 – In-lab Exercise 3 due 3/4 - Exam 2 Data...
![Page 1: CSE 250 February 16 - 20, 2009. Announcements 2/16 – In-lab Exercise 3 due 3/4 - Exam 2 Data Structures 1, 2, 3 are due Friday 3/6. However, those projects.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfac1a28abf838c9ba7a/html5/thumbnails/1.jpg)
CSE 250CSE 250February 16 - 20, 2009
![Page 2: CSE 250 February 16 - 20, 2009. Announcements 2/16 – In-lab Exercise 3 due 3/4 - Exam 2 Data Structures 1, 2, 3 are due Friday 3/6. However, those projects.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfac1a28abf838c9ba7a/html5/thumbnails/2.jpg)
AnnouncementsAnnouncements2/16 – In-lab Exercise 3 due3/4 - Exam 2
Data Structures 1, 2, 3 are due Friday 3/6. However, those projects will not be considered late as long as they are turned in by the end of the day 3/15.
![Page 3: CSE 250 February 16 - 20, 2009. Announcements 2/16 – In-lab Exercise 3 due 3/4 - Exam 2 Data Structures 1, 2, 3 are due Friday 3/6. However, those projects.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfac1a28abf838c9ba7a/html5/thumbnails/3.jpg)
AnnouncementsAnnouncementsUsing Web-CAT to submit your
assignmentsData Structures 1, 2, and 3 will
need to be submitted using Web-CAT, a new online submission mechanism. Please see ◦http://www.cse.buffalo.edu/faculty/
adrienne/SP2009/cse250/Lectures/SubmissionUsingWeb-CAT.ppt
![Page 4: CSE 250 February 16 - 20, 2009. Announcements 2/16 – In-lab Exercise 3 due 3/4 - Exam 2 Data Structures 1, 2, 3 are due Friday 3/6. However, those projects.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfac1a28abf838c9ba7a/html5/thumbnails/4.jpg)
RecursionRecursionWhat do we know about
recursion?
A recursive function is one that calls itself. Recursive functions have:◦One or more base cases◦A recursive case
![Page 5: CSE 250 February 16 - 20, 2009. Announcements 2/16 – In-lab Exercise 3 due 3/4 - Exam 2 Data Structures 1, 2, 3 are due Friday 3/6. However, those projects.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfac1a28abf838c9ba7a/html5/thumbnails/5.jpg)
![Page 6: CSE 250 February 16 - 20, 2009. Announcements 2/16 – In-lab Exercise 3 due 3/4 - Exam 2 Data Structures 1, 2, 3 are due Friday 3/6. However, those projects.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfac1a28abf838c9ba7a/html5/thumbnails/6.jpg)
Recursive Linear SearchRecursive Linear Searchpublic int linearSearch(Collection<E> items, E toFind,
int index) {
if(items.isEmpty()) return -1;
else if(items[index] == toFind) return index;
else return linearSearch(items, toFind, index+1);
}
![Page 7: CSE 250 February 16 - 20, 2009. Announcements 2/16 – In-lab Exercise 3 due 3/4 - Exam 2 Data Structures 1, 2, 3 are due Friday 3/6. However, those projects.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfac1a28abf838c9ba7a/html5/thumbnails/7.jpg)
Binary SearchBinary Search
int binarySearch(Collection<Elem_Type> items, Elem_Type searchItem)
{
if(items.isEmpty()) return -1; else return binarySearchHelper(items, itemToLookFor, 0,
items.size());}
![Page 8: CSE 250 February 16 - 20, 2009. Announcements 2/16 – In-lab Exercise 3 due 3/4 - Exam 2 Data Structures 1, 2, 3 are due Friday 3/6. However, those projects.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfac1a28abf838c9ba7a/html5/thumbnails/8.jpg)
Binary Search HelperBinary Search Helperint binarySearchHelper(Collection<Elem_Type> items,
Elem_Type searchItem, int start,
int end){if(start > end)return -1;
else { int mid = start+end /2; if(items[mid] == itemToLookFor) return mid; else if (items[mid] < itemToLookFor) return binarySearchHelper(items, itemToLookFor,
mid+1,end); else return binarySearchHelper(items, itemToLookFor,
start, mid-1); }
}
![Page 9: CSE 250 February 16 - 20, 2009. Announcements 2/16 – In-lab Exercise 3 due 3/4 - Exam 2 Data Structures 1, 2, 3 are due Friday 3/6. However, those projects.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfac1a28abf838c9ba7a/html5/thumbnails/9.jpg)
Test CasesTest CasesCome up with test cases for binary search
![Page 10: CSE 250 February 16 - 20, 2009. Announcements 2/16 – In-lab Exercise 3 due 3/4 - Exam 2 Data Structures 1, 2, 3 are due Friday 3/6. However, those projects.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfac1a28abf838c9ba7a/html5/thumbnails/10.jpg)
![Page 11: CSE 250 February 16 - 20, 2009. Announcements 2/16 – In-lab Exercise 3 due 3/4 - Exam 2 Data Structures 1, 2, 3 are due Friday 3/6. However, those projects.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfac1a28abf838c9ba7a/html5/thumbnails/11.jpg)
Trace ThroughTrace ThroughTrace through test cases to
uncover errors (code printed on previous slides fixes errors we found in lecture).
Are there more? More testing could reveal more…
![Page 12: CSE 250 February 16 - 20, 2009. Announcements 2/16 – In-lab Exercise 3 due 3/4 - Exam 2 Data Structures 1, 2, 3 are due Friday 3/6. However, those projects.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfac1a28abf838c9ba7a/html5/thumbnails/12.jpg)
![Page 13: CSE 250 February 16 - 20, 2009. Announcements 2/16 – In-lab Exercise 3 due 3/4 - Exam 2 Data Structures 1, 2, 3 are due Friday 3/6. However, those projects.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfac1a28abf838c9ba7a/html5/thumbnails/13.jpg)
Heaps / Priority QueuesHeaps / Priority Queues
![Page 14: CSE 250 February 16 - 20, 2009. Announcements 2/16 – In-lab Exercise 3 due 3/4 - Exam 2 Data Structures 1, 2, 3 are due Friday 3/6. However, those projects.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfac1a28abf838c9ba7a/html5/thumbnails/14.jpg)
![Page 15: CSE 250 February 16 - 20, 2009. Announcements 2/16 – In-lab Exercise 3 due 3/4 - Exam 2 Data Structures 1, 2, 3 are due Friday 3/6. However, those projects.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfac1a28abf838c9ba7a/html5/thumbnails/15.jpg)
![Page 16: CSE 250 February 16 - 20, 2009. Announcements 2/16 – In-lab Exercise 3 due 3/4 - Exam 2 Data Structures 1, 2, 3 are due Friday 3/6. However, those projects.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfac1a28abf838c9ba7a/html5/thumbnails/16.jpg)
![Page 17: CSE 250 February 16 - 20, 2009. Announcements 2/16 – In-lab Exercise 3 due 3/4 - Exam 2 Data Structures 1, 2, 3 are due Friday 3/6. However, those projects.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfac1a28abf838c9ba7a/html5/thumbnails/17.jpg)
![Page 18: CSE 250 February 16 - 20, 2009. Announcements 2/16 – In-lab Exercise 3 due 3/4 - Exam 2 Data Structures 1, 2, 3 are due Friday 3/6. However, those projects.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfac1a28abf838c9ba7a/html5/thumbnails/18.jpg)
![Page 19: CSE 250 February 16 - 20, 2009. Announcements 2/16 – In-lab Exercise 3 due 3/4 - Exam 2 Data Structures 1, 2, 3 are due Friday 3/6. However, those projects.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfac1a28abf838c9ba7a/html5/thumbnails/19.jpg)
![Page 20: CSE 250 February 16 - 20, 2009. Announcements 2/16 – In-lab Exercise 3 due 3/4 - Exam 2 Data Structures 1, 2, 3 are due Friday 3/6. However, those projects.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfac1a28abf838c9ba7a/html5/thumbnails/20.jpg)
![Page 21: CSE 250 February 16 - 20, 2009. Announcements 2/16 – In-lab Exercise 3 due 3/4 - Exam 2 Data Structures 1, 2, 3 are due Friday 3/6. However, those projects.](https://reader036.fdocuments.in/reader036/viewer/2022070413/5697bfac1a28abf838c9ba7a/html5/thumbnails/21.jpg)