Advanced Data Structures and Algorithms Class Notes (1)
Advanced Data Structures and Algorithms Class Notes (1)
AVL trees are height-balanced binary search trees. They maintain the balance
factor property: for any node, the heights of left and right subtrees differ
by at most 1. This guarantees O(log n) search, insertion, and deletion.
Key operations:
- Rotations (single and double) to restore balance after insert/delete.
- Calculation of balance factor and subtree heights.
Dijkstra's algorithm finds the shortest path from a source vertex to all other
vertices in a weighted graph with non-negative edges. It uses a priority queue
to repeatedly select the vertex with the minimum tentative distance.
Pseudo-code:
1. Initialize distances: dist[source] = 0, others = infinity
2. Insert all vertices into min-priority queue keyed by dist
3. While queue not empty:
a. Extract u with minimum dist
b. For each neighbor v of u, relax edge (u, v)
if dist[u] + weight(u,v) < dist[v], update dist[v]
1. Cormen, T. H., Leiserson, C. E., Rivest, R. L., & Stein, C. (2009). Introduction to Algorithms.
2. Goodrich, M. T., Tamassia, R., & Goldwasser, M. H. (2014). Data Structures & Algorithms in Java.
3. Sedgewick, R., & Wayne, K. (2011). Algorithms, 4th Edition.
4. Weiss, M. A. (2013). Data Structures and Algorithm Analysis in C++.