The Tower of Hanoi problem involves a stack of n graduated disks
and a set of three needles called A, B and C. The initial setup places then disks on needle A. The task for the player is to move the disks one at a time from needle to needle until the process rebuilds the 3 original stack but on needle C. The challenge is that at no time a CO2 K3 larger disk can be placed on top of a smaller disk. Your task is to develop a program that demonstrates the Tower of Hanoi problem. A simple demo for this problem can be found on the following web page mathworld.wolfram.com/TowerofHanoi.html. A telecommunications organization has offices spanned across multiple locations around the globe. 4 It has to use leased phone lines for connecting all these offices with CO4 K3 each other. The cost(in units) of connecting each pair of offices is different and is shown as follows: Figure 1: Phone line connection The organization, wants to use minimum cost for connecting all its offices. This requires that all the offices should be connected using minimum number of leased lines so as to reduce the effective cost. Construct the Minimum spanning tree of the above graph using Prims and Krushkal Algorithm. Suppose we want to design a system for storing employee records keyed using phone numbers. And we want following queries to be performed efficiently:
5 • Insert a phone number and corresponding information. CO5 K3
• Search a phone number and fetch the information. • Delete a phone number and related information. Identify the most suitable sorting algorithm to solve the above problem in efficient manner. Justify your answer. Imagine a situation; Shrusti is playing a card with their friends. Do you remember how you arrange your hand of cards in childhood? You first pick one card, then pick the next card and put it after the first card if it is bigger or before the first card if it is smaller; then you pick another card and insert it into its proper position. Insertion sort works similar to the way you sort playing cards in your hands.
6 CO5 K3
Figure 1: Playing card
Consider the array A [] = {6,4,8,1,3} apply the insertion sort to sort the array . Consider the cost associated with each sort is 25 rupees, Calculate the total cost of the insertion sort when element 1 reaches the first position of the array.