Data Structures

Data Structures

C Program of Huffman coding using Greedy Algorithm Approach

C Program of Huffman coding using Greedy Algorithm Approach : This code is not written by me. I found a great article on Geeks for Geeks and thought it worth sharing. Still if you have any doubts ask me in form of comments. Basic of Huffman Coding : Huffman coding is a lossless data compression algorithm. The idea is to...

C program to add two polynomials using Linked Lists

C program to add two polynomials using Linked Lists : Adding two polynomials is quite easy stuff when we do it manually :P but it requires a bit effort while programming it. I have written a simple three step Algorithm to add polynomials: 1. Seperate the like terms aside say polynomial is 2xy^2 +x^2 +x. Now we have three seperate...

C program to Find Minimum Spanning tree KRUSKAL’s Algorithm

C program to Find Minimum Spanning tree KRUSKAL's Algorithm : Kruskal's algorithm is a greedy algorithm in graph theory that finds a minimum spanning tree for a connected weighted graph. This means it finds a subset of the edges that forms a tree that includes every vertex, where the total weight of all the edges in the tree is...

C program to find Minimum Spanning tree PRIM’s Algorithm

C program to find Minimum Spanning tree PRIM's Algorithm : Prim's algorithm is a greedy algorithm that finds a minimum spanning tree for a connected weighted undirected graph. This means it finds a subset of the edges that forms a tree that includes every vertex, where the total weight of all the edges in the tree is minimized. General apporach...

C Program to Find shortest Path using dijkstra’s algorithm

C Program to Find shortest Path using Dijkstra's algorithm : Dijkstra's algorithm is a graph search algorithm that solves the single-source shortest path problem for a graph with non-negative edge path costs, producing a shortest path tree. This algorithm is often used in routing and as a subroutine in other graph algorithm. Dijkstra's Algorithm to find shortest Path : Let the...

C program of circular queue using linked list

C program of circular queue using linked list : A circular queue is one in which the insertion of new element is done at the very first location of the queue if the last location of the queue is full. Suppose if we have a Queue of n elements then after adding the element at the last index i.e....