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
How to improve these parameters? (Cascode topology, use long channel transistors)
If the current through the poly is 20nA and the contact can take a max current of 10nA how would u overcome the problem?
What is Charge Sharing? Explain the Charge Sharing problem while sampling data from a Bus
In Verilog code what does “timescale 1 ns/ 1 ps” signifies?
What is the difference between cmos and bipolar technologies?
Draw the Differential Sense Amplifier and explain its working. Any idea how to size this circuit? (Consider Channel Length Modulation)
Implement a function with both ratioes and domino logic and merits and demerits of each logic?
Write a program to explain the comparator?
what is SCR (Silicon Controlled Rectifier)?
What happens if we use an Inverter instead of the Differential Sense Amplifier?
How does the size of PMOS Pull Up transistors (for bit & bit- lines) affect SRAM's performance?
How can you model a SRAM at RTL Level?
What is the function of tie-high and tie-low cells?
Describe the various effects of scaling?
Draw the SRAM Write Circuitry