Question: Design related problems ( a ) Translate the Insertion - sort algorithm discussed in the class into a program which takes n numbers ( real
Design related problems
a Translate the Insertionsort algorithm discussed in the class into a program which takes numbers real or integers Inputs for the program is and the numbers.
b Given a sequence of numbers real or integers and a number is one among the numbers write an algorithm and the corresponding code to compute the position of if the given numbers are arranged in an increasing order, using insertionsort. If the and are the input, your program should output since will be in the fourth position starting from in the sorted increasing order. You are expected to code the problem two different ways, say, using two different approaches. Decide whether is efficient or is efficient based on the running time of the resepctive codes.
c All the alphabetslower case of english language dots, are assigned values dots, Given a sequence of symbols from english alphabet only lower case write an
insertionsort based algorithm to arrange the given symbols, in an increasing order of their values. You are expected to code the problem two different ways, say, using two different approaches. Decide whether is efficient or is efficient based on the running time of the resepctive codes.
d Given a sequence of numbers real or integers write an algorithm and the corresponding code to arrange the given numbers are arranged in such a way that all the negative numbers if any are arranged in a descending order and all the positive numbers are arranged in an increasing order with zero if it is in the input appearing between the smallest negative number and the smallest positive number. If the output should be If the output should be should be the output. If the output should be
e Given points dots, with the coordinates dots, respectively, write an insertionsort based algorithm and the corresponding code to arrange the points in an increasing order of the distance of the point from the origin with as the coordinates. Distance between any two points and is Input for the code is: and the coordinates of the points entered with coordinate first and then the coordinate.
e Compute the running time of in seconds for the insertionsort algorithm for different inputs and draw the graph Vs
f Compute the for all the codes requested in
QNo
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
