Lecture Notes – April 21, 2005

 

  1. We went over a number of examples showing various things that could go wrong when incorrectly trying to make a copy of an array.  These included:

v     merely copying the address so that both variable names referenced the same array

v     copying the address backwards after the loop generating the values, so that the generated values disappeared  DriverSortV2

v     copying the address backwards inside the loop generating the values which caused only the first generated value to disappear  DriverSortV1

v     copying the address backwards before the loop generating the values which caused both references to refer to the same array and the generated values to all be there  DriverSortV3copying the address before the loop and then modifying one value in each array after the loop generating the values and seeing that the references were the same and the changes show up regardless of which reference is used to print the arrays  DriverSortV4

v     making an item by item variant of each value  generated so that the references pointed to two different arrays and we could see that they were different.  DriverSortV6

v     copying the address correctly inside the loop so that the first element will also be correct  but it copies the address multiple times when it only has to do it once. DriverSortV5

 

  1. We went over  Lab 24 and discussed the possibilities for each answer.  We emphasized the difference between an abstract data type (ADT) and the  data structures that could be used to implement them.

      

   Abstract data types             

Data structures that can be used to implement ADT

v     A list

An array, an ArrayList, a LinkedList

v     A stack

An array, an ArrayList, a LinkedList

v     A queue

An array, an ArrayList, a LinkedList

 

  1. We emphasized the operations that can be performed on a queue

v     enqueue

v     dequeue

v     isEmpty

v     possibly  isFull

 

  1. Asked students to try to see me next week for individual grading of their remaining labs and programs

 

  1. Remembered that final exam is, Wednesday evening, May 4th, 7-10pm in ISAT/CS 159

 

  1. Announced that there will not be an additional programming assignment.