Please enable JavaScript.
Coggle requires JavaScript to display documents.
ICS 46 Final Topics (Trees (BST (AVL (Rotations (Used to Balance), "…
ICS 46 Final Topics
Trees
-
-
B-Trees
-
-
-
Searching
-
- If not, which between which two
-
-
Digital Trees
-
-
Searching
-
- If values same, keep going
- If value not possible return false
- If all satisfied, return if node specifies in tree
-
Dsiplaying
Predorder
Print Level by level, left to right
-
-
Heaps
-
-
-
Removing
-
- Put bottom node value at top
-
-
-
-
Analysis of Algo
-
-
Big Theta
For N > x, c1 g(n) < f(n) < c2 g(n)
When O == Omega == Theta, "Solved"
-
-
Sorting
O(N^2)
Insertion Sort
-
-
-
Process
-
- Swap if one on right is smaller
- Keep going until left is smaller
-
-
-
Selection Sort
-
-
-
Process
-
- Add swap next "unsorted" with lowest
-
-
-
O(N logN)
-
Quick sort
-
-
-
Process
-
- Go from left to find larger
- Go from right to find smaller
-
- Repeat until left and right are same spot
- Switch Pivot with final location
-
-
-
Comparisons: O(N^2) worst, O(N logN) avg
Swaps: O(N^2) worst, O(N logN) avg
Merge sort
-
-
Process
- Split in left and right array
- Keep splitting until down to 2 values
-
-
-
-
-
Heap Sort
-
-
-
Process
-
-
- Put to end and rebalance stack
-
-
-
-
Bucket Sort
-
Process
- Place items into sorted buckets
- Sort items within each bucket
-
-
Hash Tables
Collisions
Probing
-
-
If Index already taken, find next open
-
Deleting
-
-
- Mark array index as "deleted" so search does not see as empty
-
-
-
Graphs
Graph Algorithms
Shortest Path
- Make empty Maps for answer and Info
- Create a priority queue with priority given to lowest distance
-
-
-
d. If sum is less than current distance to "new_node", replace distance with new distance
- Repeat 3 until PQ is empty
Definitions
Spanning Tree
-
Minimum Spanning tree
-
Algorithm
- Add all edges to priority queue
- Remove the top and put two nodes in same equivalence class
-
4a. If the edges are not in same equivalence class, add edge to tree
- Repeat step 3 and 4 until empty
4b. If in same class, do nothing
-
-
-
-
-
-
-
-
-
-