Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| courses:cs211:winter2018:journals:martinj:2.4 [2018/01/30 03:21] – created martinj | courses:cs211:winter2018:journals:martinj:2.4 [2018/01/30 03:51] (current) – martinj | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== 2.4 ====== | + | ====== 2.4: Runtimes |
| + | This Chapter went into further detail about some common running times, including: | ||
| + | __**Linear time O(n)**__ | ||
| - | ====== 2.5 ====== | + | 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. |
| - | ====== 3.1 ====== | + | __**O(nlogn) Time**__ |
| - | Brief summary of the section | + | This is the running time of any algorithm that splits its inputs into two equal-sized pieces, solves each piece recursively, |
| - | ~1 paragraph | + | |
| - | feel free to write more if that will help you | + | |
| - | Include motivations | + | __**Quadratic Time**__ |
| - | For algorithms, brief sketch | + | |
| - | Include | + | Example |
| - | Questions you have about motivation/ | + | |
| - | Discuss anything | + | |
| - | Anything that you want to remember, anything | + | __**Cubic Time**__ |
| - | Say something about how readable/interesting | + | |
| + | From what I can tell, only happens with triple-nested loops, each of which operates at a runtime of O(n). They compound to make the runtime cubic. | ||
| + | |||
| + | |||
| + | __**O(n^k) Time**__ | ||
| + | |||
| + | We obtain a runtime of O(n^k) for any constant k when we search over all subsets of size k. | ||
| + | |||
| + | |||
| + | __**Bigger than Polynomial**__ | ||
| + | |||
| + | Things that are order O(n!), such as finding the number of ways to match up n items with n other items, are even more costly than functions of an order like O(n^2) | ||
| + | |||
| + | |||
| + | __**Smaller than Linear**__ | ||
| + | |||
| + | Binary search algorithm is O(logn). This runtime | ||
| + | |||
| + | |||
| + | |||
| + | This chapter was very straightforward. The only algorithms it detailed were to demonstrate runtimes of simple algorithms such as those mentioned above. I don' | ||
| + | ====== 2.5: Priority Queues ====== | ||
| + | This section focused on priority queues. It started with a general introduction of the data structure, which includes elements | ||
| + | |||
| + | Heapify-up(H, | ||
| + | If i>1 then | ||
| + | let j=parent(i)=[i/2] | ||
| + | If key[H[i]]< | ||
| + | swap H[i] and H[j] | ||
| + | Heapify-up(H, | ||
| + | Endif | ||
| + | Endif | ||
| + | |||
| + | |||
| + | It also includes heapify-down, | ||
| + | |||
| + | |||
| + | |||
| + | ====== 3.1: Graphs ====== | ||
| + | This section obviously focuses on graphs. The first couple of pages simply lists out common examples of graphs in our everyday life. They seem to be everywhere! Very promising and exciting! Everything discussed about graphs in this section was extremely basic, and relates directly back to the discrete math class I had last semester. All of the terms such as node, path, directionality, | ||
