Suggestion 1 Answer
Suggestion 1 Answer
Short Notes:
Could you clarify the topic or subject for the short notes? For example, is it for a specific
subject, concept, or idea?
Asymptotic notations
Heap sort
Approaches to solve recurrence
Backtracking Algorithm
Short Notes:
1. Asymptotic Notations
Asymptotic notations are mathematical tools to describe the time complexity or space
complexity of an algorithm in terms of input size n.
Big-Theta (Θ): Tight bound; average-case scenario when the function grows at the same
rate in both upper and lower bounds.
2. Heap Sort
Heap Sort is a comparison-based sorting algorithm that uses a binary heap structure.
Steps:
2. Extract the largest element (root) and place it at the end of the array.
3. Reduce the heap size and heapify the root. Repeat until the heap size is 1.
Complexity:
1/5
3. Approaches to Solve Recurrence
Recursion Tree Method: Visualize the recurrence as a tree and sum the work done at
each level.
Master Theorem: Provides a direct solution for recurrences of the form T (n) =
aT (n/b) + f (n).
Iteration Method: Expand the recurrence repeatedly to find a pattern and derive the
closed form.
4. Backtracking Algorithm
Backtracking is a systematic way to explore all possibilities for solving problems like
constraint satisfaction, pathfinding, or combinatorics.
Steps:
Applications:
N-Queens Problem
Sudoku Solver
Hamiltonian Cycle
Complexity: Generally exponential O(k n ), where k is the branching factor and n is the
depth.
Dynamic programming
Spanning trees
2/5
All-Pairs Shortest Paths
Minimum Spanning Tree
Short Notes:
Steps:
Types:
Applications:
2. Spanning Trees
A spanning tree of a graph is a subgraph that is a tree and connects all vertices with the
minimum number of edges.
Properties:
Applications:
3/5
3. All-Pairs Shortest Paths (APSP)
The APSP problem finds the shortest paths between all pairs of vertices in a graph.
Algorithms:
Johnson's Algorithm: Suitable for sparse graphs, uses Bellman-Ford and Dijkstra;
O(V 2 log V + V E).
Naïve Method: Apply Dijkstra or Bellman-Ford for each vertex as the source; O(V ⋅
Tsingle−source ).
Applications:
An MST is a spanning tree of a weighted, connected graph that has the smallest possible
total edge weight.
Algorithms:
Prim's Algorithm: Greedy method, works well with dense graphs; O(V 2 ) or
O(E + log V ) with a priority queue.
Kruskal's Algorithm: Greedy method, sorts edges and uses Union-Find for cycle
detection; O(E log E).
Applications:
Properties:
4/5
5/5