Write a pseudo code for sorting the numbers in an array?
Answers were Sorted based on User's Feedback
Answer / 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 |
What is Charge Sharing? Explain the Charge Sharing problem while sampling data from a Bus
Implement a 2 I/P and gate using Tran gates?
what is SCR (Silicon Controlled Rectifier)?
Design an 8 is to 3 encoder using 4 is to encoder?
Explain the difference between write through and write back cache.
verify nmos passes good logic 0 and passes bad logic 1.also verify that pmos passes good logic 1 and passes bad logic 0.
2 Answers Cosmic Circuits, HP,
How to find the read failiure probablity in SRAM?
Explain what is the depletion region?
What is the difference between fifo and the memory?
6 Answers DewSoft, Intel, Pentagon Rugged Systems,
What is the mealy and moore machine's state diagram that can detect 3 consecutive heads of 3 coins ?
What happens to delay if you increase load capacitance?
Id vs. Vds Characteristics of NMOS and PMOS transistors?
1 Answers Brillient, Intel, ISRO,