Priority Queue Using Singly Linked List

In priority queue using a singly linked list problem, we need to implement a priority queue by using a singly linked list. A priority queue contains the following operations, push(x, p): Add an element x with priority p at an appropriate position in the priority queue. pop(): Remove and return …

Read morePriority Queue Using Singly Linked List

Breadth First Search (BFS) for a Graph

Breadth First Search (BFS) for a graph is a traversing or searching algorithm in tree/graph data structure. It starts at a given vertex(any arbitrary vertex) and explores all the connected vertex and after that moves to the nearest vertex and explores all the unexplored nodes and takes care that no …

Read moreBreadth First Search (BFS) for a Graph

Minimum Characters to be Removed to Make a Binary String Alternate

Problem Statement Given a binary string, write a program that will find the minimum number of characters that can be removed from this string so that it becomes alternate. A binary string is said to be alternate if there are no consecutive 0’s or 1’s Input Format The first line …

Read moreMinimum Characters to be Removed to Make a Binary String Alternate