Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

what is verilog?

1058


Differences between Array and Booth Multipliers?

4016


What does it mean “the channel is pinched off”?

1308


Give the logic expression for an AOI gate. Draw its transistor level equivalent. Draw its stick diagram

1411


Explain Cross section of an NMOS transistor?

980


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

1090


Process technology? What package was used and how did you model the package/system? What parasitic effects were considered?

3077


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

997


How logical gates are controlled by boolean logic?

1022


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

2352


For CMOS logic, give the various techniques you know to minimize power consumption

1349


Explain how MOSFET works?

3195


Mention what are the different gates where Boolean logic are applicable?

1060


How does the size of PMOS Pull Up transistors (for bit & bit- lines) affect SRAM's performance?

1173


why is the number of gate inputs to CMOS gates usually limited to four?

1278