Prim’s Algorithm is a popular greedy algorithm used to find the Minimum Spanning Tree (MST) of a connected, weighted graph.
Kruskal’s algorithm is one of the popular algorithms used to find an MST in a connected weighted graph. This algorithm is efficient, easy to understand, and guarantees the construction of a minimum-weight spanning tree.
Dijkstra’s algorithm works based on the principle of Greedy-approach, gradually expanding the search space until the shortest path to the destination node is found.
Given an array consisting of only 1s and 0s, sort this binary array such that all 0s are on the left and all 1s are on the right.
Given a string of lowercase letters in the range ascii[a-z], determine the index of a character that can be removed to make the string a palindrome
Hotel Bytelandia Solution – A number of guests have made reservations. Each reservation consists of an arrival time, and a departure time
You’re given the maximum speed of N cars in the order they entered the long straight segment of the circuit. Each car prefers to move at its maximum speed. If that’s not possible because of the front car being slow, it might have to lower its speed. It still moves at the fastest possible speed while avoiding any collisions.
Tomya like a positive integer p, and now she wants to get a receipt of Ciel’s restaurant whose total price is exactly p. Note that the i-th menu has the price 2i-1 (1 ≤ i ≤ 12). Find the minimum number of menus whose total price is exactly p.
Huffman codes are a widely used technique for compressing data. Huffman codes is a greedy algorithm to build up an optimal way of representing each character as a binary string. Suppose we have a 10,000 character data file that we wish to store. And we observe a character ‘a’ occurs very frequently.
Activity selection problem is the problem of selecting the largest set of mutually exclusive activities. Each activity has its own starting time si and finish time fi. No two activities can share the resource at any time point.