In the previous chapter we learnt about tree traversal. In this chapter we shall learn about graph traversal. Graph traversal can be done in 2 ways: DFS: Depth first search BFS: Breadth first search Depth First Search As the name suggests, we take …
In the previous chapter we have seen representing graph using Adjacency Matrix. The drawback is that it consumes large amount of space if the number of vertices increases. Hence in this chapter we shall look at more efficient way of representing of the graph, using Adjacency …
In this tutorial we shall see how to store a graph with the help of a matrix. As it stores the path between 2 vertices, it is called as adjacency matrix. The idea is to take 2D array of size V * V, then mark …
In this chapter we shall learn about: Graph Definition Types of graph Usage of graph Graph like trees is a non linear data structure. Like trees, graph is also made of collection of nodes/vertices and edges. But unlike trees, graph will not have any root …
Before we understand what is lazy propagation, we shall understand the need for lazy propagation. Consider the array below and the corresponding segment tree for min element range query. Segment Tree: Now suppose you need to increment all the elements from …
In this chapter we shall learn about below topics: AVL Tree Introduction Need of AVL Tree? LL Rotation RR Rotation LR Rotation RL Rotation Introduction to AVL Tree: A tree can be called as AVL tree, if it satisfies below 2 properties: It should be …
In this chapter we shall learn about priority queue and it’s implementation using Linked list using C language. A priority queue is a collection of elements, where each element is assigned a priority. Based o the priority the elements are inserted or deleted from the priority …