These solutions don’t always produce the best optimal solution but can be used to get an approximately optimal solution. A Greedy choice for this problem is to pick the nearest unvisited city from the current city at every step. For example, Traveling Salesman Problem is an NP-Hard problem. The greedy algorithms are sometimes also used to get an approximation for Hard optimization problems. The Greedy Choice is to assign the least bit length code to the most frequent character. It assigns variable-length bit codes to different characters. Huffman Coding is a loss-less compression technique. The Greedy Choice is to pick the edge that connects the two sets and is on the smallest weight path from the source to the set that contains not yet included vertices 4) Huffman Coding : We maintain two sets: a set of the vertices already included in the tree and a set of the vertices not yet included. The shortest-path tree is built up, edge by edge. ISRO CS Syllabus for Scientist/Engineer Examĭijkstra’s algorithm is very similar to Prim’s algorithm.ISRO CS Original Papers and Official Keys.GATE CS Original Papers and Official Keys.Top 10 System Design Interview Questions and Answers.Top 20 Puzzles Commonly Asked During SDE Interviews.Top 100 DSA Interview Questions Topic-wise.