Class Notes (836,153)
Canada (509,662)
CS 138 (14)
Lecture 13

Data Lecture 13.docx

3 Pages
Unlock Document

Computer Science
CS 138
Michael Godfrey

Data Lecture 13 February 26, 2013 Lists  Lists can be ordered by: o Insertion time  Stacks  Queues o Element key value  Sorted linked list  Binary Search Tree o Combination  Priority queue  Getting linked structures right o Often don’t notice bugs until much “later” o Think defensively  Set ptrs to NULL if not going to be used immediately  Create “state reporting functions”  Use I/O & assertions to check  Draw pictures  Break down procedures by cases  Empty list  Insert at beginning  Last element  Testing  Create and maintain large number of test cases! Regression Testing & Test-Driven Development  Waterfall model  Iterative model w/ mini-cycle of waterfall  Write the test case first o Then write simplest possible code to pass the test Example struct Node { string val; string otherstuff; Node *next; }; typedef Node* SortedList; void initList (SortedList & first) { first=NULL; } bool isEmpty (const SortedList & first) { return NULL==first; } bool look
More Less

Related notes for CS 138

Log In


Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.