Follow Me

Priority queue exercises in C Programming in C

  • Dijkstra Algorithm: A famous solution for the shortest path problem was developed by Dijkstra. Dijkstra's algorithm is a generalization of the BFS algorithm. The regular BFS algorithm cannot solve the shortest path problem as it cannot guarantee that the vertex at the f...
  • Prim Algorithm - Minimal Spanning Tree: A minimum spanning tree of an undirected graph \(G\) is a tree formed from graph edges that connect all the vertices of \(G\) with minimum total cost (weights). A minimum spanning tree exists only if the graph is connected. Prim's algorithm is almos...
  • Dynamic implementation of a priority queue: A priority queue is an abstract data type which is like a regular queue, but where additionally each element has a "priority" associated with it. In a priority queue, an element with high priority is served before an element with low priority. In som...
  • Graph Edge Property: Running DFS on a connected graph generates a DFS spanning tree (or spanning forest if the graph is disconnected). With the help of one more vertex state: EXPLORED  (visited but not yet completed) on top of VISITED (visited and completed), we can use...
  • UVA 10009 - All Roads Lead Where: There is an ancient saying that "All Roads Lead to Rome". If this were true, then there is a simple algorithm for nding a path between any two cities. To go from city A to city B, a traveller could take a road from A to Rome, then from Rome to B. Of ...
  • UVA 1112 - Mice and Maze: A set of laboratory mice is being trained to escape a maze. The maze is made up of cells, and each cell is connected to some other cells. However, there are obstacles in the passage between cells and therefore there is a time penalty to overcome the ...
  • Priority Queue and Min heap: A min heap H is a binary tree having the following property:\ $\forall N \in H, \forall \ LN \in LEFT(N), \forall \ RN \in RIGHT(N), data(N) \leq data(LN) $ and $ data(N) \leq data(RN)$ Jobs arriving to a computer system for processing are given a pr...

Back to the list of exercises