Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious 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 2: | Line 2: | ||
| This Chapter went into further detail about some common running times, including: | This Chapter went into further detail about some common running times, including: | ||
| - | __**Linear time O(n)** | + | __**Linear time O(n)**__ |
| - | __ | + | |
| This running time is at most a constant factor times the size of the input. Common problems that have this running time include computing the maximum and merging two sorted lists. | This running time is at most a constant factor times the size of the input. Common problems that have this running time include computing the maximum and merging two sorted lists. | ||
| 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 | ||
| + | |||
| + | |||
| + | It also includes heapify-down, | ||
| - | ====== 3.1 ====== | ||
| - | Brief summary of the section | + | ====== 3.1: Graphs ====== |
| - | ~1 paragraph | + | This section |
| - | 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 | + | |
| - | Include runtime for algorithms | + | |
| - | Questions you have about motivation/ | + | |
| - | Discuss anything | + | |
| - | Anything | + | |
| - | Say something | + | |
