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
If not into production, how far did you follow the design and why did not you see it into production?
What is the difference between cmos and bipolar technologies?
what is verilog?
For a single computer processor computer system, what is the purpose of a processor cache and describe its operation?
What are the steps involved in preventing the metastability?
Explain why present VLSI circuits use MOSFETs instead of BJTs?
What is Body Effect?
what is Slack?
Cross section of a PMOS transistor?
If an/ap = 0.5, an/ap = 1, an/ap = 3, for 3 inverters draw the transfer characteristics?
Explain sizing of the inverter?
What types of CMOS memories have you designed? What were their size? Speed?
What transistor level design tools are you proficient with? What types of designs were they used on?
What happens if we use an Inverter instead of the Differential Sense Amplifier?
In the design of a large inverter, why do we prefer to connect small transistors in parallel (thus increasing effective width) rather than lay out one transistor with large width?