Skip to content

Commit

Permalink
Fixed more rendering issues in 126 notes
Browse files Browse the repository at this point in the history
  • Loading branch information
EdmundGoodman committed May 9, 2021
1 parent 1cbbd89 commit d967f2b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cs126/part3.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ nex: part4
- Recursion can be defined in various ways:
- "When a method calls itself" (*Data Structures and Algorithms in Java*, Goodrich, Tamassia, Goldwasser)
- "A method which is expressed in terms of calls to simpler cases of itself, and a base case" (*crsg-guide*, Edmund Goodman)
- It's a recursive reference, get it? :upside_down_face:
- It's a recursive reference, get it? :upside_down_face:
- Recursive functions contain two main components
- Base cases
- Simple input values where the return value is a known constant, so no recursive calls are made
Expand All @@ -36,4 +36,4 @@ nex: part4
- Linear recursion
- Each functional call makes only one recursive call (there may be multiple different possible calls, but only one is selected), or none if it is a base case
- Binary/multiple recursion
- Each functional call makes two/multiple recursive calls, unless it is a base case
- Each functional call makes two/multiple recursive calls, unless it is a base case
4 changes: 2 additions & 2 deletions cs126/part5.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ nex: part6
- To remove an item, we cannot just set it to null again, as that would mean it stops probing, even though there might be subsequent elements. Instead, we replace it with a "DEFUNCT" element, which is just skipped over when probing
- Double hashing
- When a collision occurs, the key is re-hashed with a new hash function
- Sometimes $$[h(k) + i \cdot f(k)]\ MOD\ N$$ where $$h$$ and $$f$$ are hashing functions, and $$i \in \Z$$ is used
- As before, there are many implementations of the hash function, but $$f(k)= q-k\ MOD\ q \quad | \quad q<N, q \in primes$$
- Sometimes $$[h(k) + i \cdot f(k)]\ MOD\ N$$ where $$h$$ and $$f$$ are hashing functions, and $$i \in \mathbb{Z}$$ is used
- As before, there are many implementations of the hash function, but $$f(k)= q-k\ MOD\ q \quad \| \quad q<N, q \in primes$$
- Searching is similar to linear probing, but when iterating we look at the hash value for each $$i$$, rather than just the next index in the table
- This helps avoid the issue of colliding items "lumping together" as in linear probing
- Resizing a hash table
Expand Down
2 changes: 2 additions & 0 deletions cs126/part8.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ nex: part9
- Heap-order, for every internal node other than the root (as it has no parent), the value of the node is greater than the value of the parent node
- Complete binary tree, the height of the tree is minimal for the number of the nodes it contains, and is filled from "left to right". This is formally defined as:
> Let $$h$$ be the height of the heap
>
> ​ Every layer of height $$i$$ other than the lowest layer ($$i = h-1$$) has $$2^i$$ nodes
>
> ​ In the lowest layer, the all internal nodes are to the left of external nodes
- The last node of the heap is the rightmost node of maximum depth
![heapDiagram](./images/heapDiagram.png)
Expand Down

0 comments on commit d967f2b

Please sign in to comment.