Section 2.3: In this section of the chapter the book explains arrays and lists and how they can be used to manipulate data. It also discusses the differences in run times for functions. For example, a list has constant time to “find” and element, has linear time to check if an element belongs in the list or logn time if the list is already sorted. However, an array has a pointer to the first element (and possibly the last) therefore it is constant to insert or remove an element but it takes linear time to find an element. The rest of the section applies the two structures to the stable matching algorithm.

Section 2.4: This section surveys a selection of common run time for functions. The book individually describes the six types of run times. For each run time the book describes the process of deciding the run time and explaining the importance of this formation. For example it discusses linear time verses nlogn time verses quadratic time. It also provides basic algorithms for the run times so that reader can understand how efficient a function is.

Section 2.5: This last section describes a priority queue as a sophisticated data structure. This data structure maintains a set of elements such that each element has a key (value) denoting its importance within the list. The rest of the section explains how to implement a priority queue, how efficient each function runs within a priority queue and also how a heap can construct a simple form of a priority queue. Lastly, the book describes how elements can be added and delecting from a heap by using heapify-up and heapify-down. These separate functions allows the heap to remain a balanced binary tree. After understanding more about the structure, I was able to truly understand the elegance of its efficiency. The very last part of the section goes over the five main functions of a priority queue (implemented with heap) and how a programmer can use it to process data.

courses/cs211/winter2011/journals/ashley/chapter2.2.txt · Last modified: 2011/01/26 14:07 by leinwebera
CC Attribution-Noncommercial-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0