Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| courses:cs211:winter2018:journals:martinj:2.4 [2018/01/30 03:33] – martinj | courses:cs211:winter2018:journals:martinj:2.4 [2018/01/30 03:51] (current) – martinj | ||
|---|---|---|---|
| Line 40: | Line 40: | ||
| This chapter was very straightforward. The only algorithms it detailed were to demonstrate runtimes of simple algorithms such as those mentioned above. I don't have any questions about it and I think learning this will just be very straightforward and memorization-focused. | This chapter was very straightforward. The only algorithms it detailed were to demonstrate runtimes of simple algorithms such as those mentioned above. I don't have any questions about it and I think learning this will just be very straightforward and memorization-focused. | ||
| ====== 2.5: Priority Queues ====== | ====== 2.5: Priority Queues ====== | ||
| + | This section focused on priority queues. It started with a general introduction of the data structure, which includes elements that each have priority values (keys). This allows us to select the elements in the queue by order of priority. It allows addition, deletion, and the selection of the element with the smallest key in O(logn) time each. The chapter then goes on to introduce the heap, which is a data structure for implementing a priority queue. It is a sort of balanced binary tree with a root and nodes that can each have up to two children. The keys are in "heap order" if the key of any element is at least as large as the key of the element at its parent node. The chapter then goes into heap operations, including heapify-up, which allows us to insert a new element in a heap of n elements in O(logn) time. It looks like... | ||
| + | Heapify-up(H, | ||
| + | If i>1 then | ||
| + | let j=parent(i)=[i/ | ||
| + | If key[H[i]]< | ||
| + | swap H[i] and H[j] | ||
| + | Heapify-up(H, | ||
| + | Endif | ||
| + | Endif | ||
| - | ====== 3.1 ====== | ||
| - | Brief summary | + | It also includes heapify-down, |
| - | ~1 paragraph | + | |
| - | feel free to write more if that will help you | + | |
| - | Include motivations for the given problem, | + | |
| - | For algorithms, brief sketch of algorithm, intuition, and implementation | + | ====== 3.1: Graphs ====== |
| - | Include runtime for algorithms | + | This section obviously focuses on graphs. The first couple |
| - | Questions you have about motivation/ | + | |
| - | Discuss anything | + | |
| - | Anything | + | |
| - | Say something | + | |
