Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
courses:cs211:winter2018:journals:patelk:chapter2 [2018/01/28 20:11] – [2.5 A More Complex Data Structure: Priority Queues] patelkcourses:cs211:winter2018:journals:patelk:chapter2 [2018/01/28 20:18] (current) – [2.5 A More Complex Data Structure: Priority Queues] patelk
Line 229: Line 229:
  
 __The Heap:__ balanced binary tree; root + nodes with up to two children; key of any element is at least as large as the key of the parent node __The Heap:__ balanced binary tree; root + nodes with up to two children; key of any element is at least as large as the key of the parent node
 +
   * For a heap with bound N, we can use an array   * For a heap with bound N, we can use an array
   * H[1] is the root   * H[1] is the root
-  * leftChild(i) = 2i  // rightChild(i) = 2i+1  +  * leftChild(i) = 2i 
-  * k+  rightChild(i) = 2i+1 
  
  
 **Implementing the Heap Operations** **Implementing the Heap Operations**
  
-  * Identifying Minimal Element:** O(1)** +  * Identifying Minimal Element: **O(1)**
   * Adding an Element: add element to the final position, then perform heapify-up recursively -> **O(logn)**   * Adding an Element: add element to the final position, then perform heapify-up recursively -> **O(logn)**
  
Line 255: Line 255:
   * __Delete(H,i):__ deletes element in position i -> **O(logn)**   * __Delete(H,i):__ deletes element in position i -> **O(logn)**
   * __ExtractMin(H):__ identifies and deletes minimum key element -> **O(logn)**   * __ExtractMin(H):__ identifies and deletes minimum key element -> **O(logn)**
 +
 +----
 +
 +==== Personal Thoughts ====
 +
 +This section was pretty straightforward and easy to follow. I think going over the concepts in class before reading this section of the textbook was helpful in clarifying things that maybe would have been otherwise confusing. I appreciated the summary of the operation run times as these can sometimes be difficult to recall.
 +Readability: 9
 +Interesting: 6
 +
 +
  
  
courses/cs211/winter2018/journals/patelk/chapter2.1517170275.txt.gz · Last modified: by patelk
CC Attribution-Noncommercial-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0