Write a pseudo code for sorting the numbers in an array?

Answers were Sorted based on User's Feedback



Write a pseudo code for sorting the numbers in an array?..

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

Write a pseudo code for sorting the numbers in an array?..

Answer / vicneswary

5 1 3 2 4
1 3 5 2 4
1 2 3 5 4
1 2 3 4 5

Is This Answer Correct ?    3 Yes 8 No

Post New Answer

More VLSI Interview Questions

For a single computer processor computer system, what is the purpose of a processor cache and describe its operation?

0 Answers   Intel,


Draw the SRAM Write Circuitry

0 Answers   Infosys,


Draw the Cross Section of an Inverter? Clearly show all the connections between M1 and poly, M1 and diffusion layers etc?

0 Answers   Intel,


What is threshold voltage?

0 Answers  


Approximately, what were the sizes of your transistors in the SRAM cell? How did you arrive at those sizes?

0 Answers   Infosys,






Insights of a 2 input NOR gate. Explain the working?

1 Answers   Infosys, Intel,


What are the limitations in increasing the power supply to reduce delay?

2 Answers   Infosys,


Draw the timing diagram for a SRAM Read. What happens if we delay the enabling of Clock signal?

0 Answers   Infosys,


Explain the operation considering a two processor computer system with a cache for each processor.

0 Answers   Intel,


What is the depletion region?

1 Answers  


Define threshold voltage?

32 Answers   College School Exams Tests, Intel, JHG, Wipro,


What are set up time & hold time constraints? What do they signify?

3 Answers  


Categories