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

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

1 Answers   Infosys, Intel,


Explain how logical gates are controlled by Boolean logic?

0 Answers  


What are the different design techniques required to create a layout for digital circuits?

0 Answers  


what is body effect?

1 Answers  


Explain various adders and difference between them?

0 Answers   Intel,






What is the difference between nmos and pmos technologies?

0 Answers  


What happens to delay if you increase load capacitance?

3 Answers   Infosys,


What is the function of tie-high and tie-low cells?

0 Answers  


What r the phenomenon which come into play when the devices are scaled to the sub-micron lengths?

4 Answers   Intel,


Explain why & how a MOSFET works?

2 Answers   Infosys,


what is Slack?

0 Answers  


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,


Categories