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 are the ways to Optimize the Performance of a Difference Amplifier?
Why does the present vlsi circuits use mosfets instead of bjts?
What are the steps required to solve setup and hold violations in vlsi?
Mention what are three regions of operation of mosfet and how are they used?
What is the difference between the mealy and moore state machine?
How does a Bandgap Voltage reference work?
Differences between IRSIM and SPICE?
Help with VHDL programming. Write a VHDL code for a D-Latch with clear input ?? (Hint: Set up a “Process” with appropriate sensitivity list to get the desired D-Latch with Clr working.) Inputs AND OUTPUTS: entity Lab4b is Port ( Clr, Clk, D : in STD_LOGIC; Q : out STD_LOGIC); end Lab4b;
How can you construct both PMOS and NMOS on a single substrate?
What is the critical path in a SRAM?
Explain how Verilog is different to normal programming language?
Explain Cross section of an NMOS transistor?
What types of CMOS memories have you designed? What were their size? Speed?
What are the changes that are provided to meet design power targets?
What are the different ways in which antenna violation can be prevented?