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

If not into production, how far did you follow the design and why did not you see it into production?

2110


What is the difference between cmos and bipolar technologies?

1143


what is verilog?

1146


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

2411


What are the steps involved in preventing the metastability?

1131


Explain why present VLSI circuits use MOSFETs instead of BJTs?

1159


What is Body Effect?

2529


what is Slack?

1197


Cross section of a PMOS transistor?

4780


If an/ap = 0.5, an/ap = 1, an/ap = 3, for 3 inverters draw the transfer characteristics?

2514


Explain sizing of the inverter?

4441


What types of CMOS memories have you designed? What were their size? Speed?

3147


What transistor level design tools are you proficient with? What types of designs were they used on?

3451


What happens if we use an Inverter instead of the Differential Sense Amplifier?

3319


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?

1201