Write a pseudo code for sorting the numbers in an array?
Answer Posted / prabhath
SelectionSort(A)
for i <- length[A]-1 downto 0
for j <- 0 to i
if (A[j]>MAX) // for descending, change this to MIN
MAX=A[j]
MAX_ID=j
temp=A[i]
A[i]=A[MAX_ID]
A[MAX_ID]=temp
Slow motion run of Selection Sort (Bold == sorted region):
5 1 3 2 4
4 1 3 2 5
1 3 2 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5 >> done
Is This Answer Correct ? | 22 Yes | 14 No |
Post New Answer View All Answers
What is the function of tie-high and tie-low cells?
For f = AB+CD if B is S-a-1, what are the test vectors needed to detect the fault?
For an AND-OR implementation of a two input Mux, how do you test for Stuck-At-0 and Stuck-At-1 faults at the internal nodes? (You can expect a circuit with some redundant logic)
How does a Bandgap Voltage reference work?
What types of high speed CMOS circuits have you designed?
What happens if we use an Inverter instead of the Differential Sense Amplifier?
What are the steps involved in preventing the metastability?
Explain the operation of a 6T-SRAM cell?
What are the different gates where boolean logic are applicable?
Draw the Layout of an Inverter?
How does the size of PMOS Pull Up transistors (for bit & bit- lines) affect SRAM's performance?
Draw the Cross Section of an Inverter? Clearly show all the connections between M1 and poly, M1 and diffusion layers etc?
What are the Advantages and disadvantages of Mealy and Moore?
Implement a function with both ratioes and domino logic and merits and demerits of each logic?
How to improve these parameters? (Cascode topology, use long channel transistors)