Authour:I will teach you courses online
C Language | C++ | Asp.net | VB.net | Oracle | Hardware and Networking | MCSE |
Contact: | Name: Shrinivas | Mobileno:919703619391 | E-mail: vas.shrinivas002@gmail.com |
First understand this:
Let us assume we taken below array
var a=["9","8","3","2","8","11","7"]
First understand this:
step1:-->if (r[i]<=r[j])
t=t+1;
Above array 11 is biggest number,Based on above condition t will return
zenrate:t=1 for Highest no 11
t=2 for second biggest no 9
t=3 for third biggest no 8
t=4 for fourth biggest no 7
t=5 for fifth biggest no 3
t=6 for least no---------2
Now i am inserting highest number in last of array index that b[5]=r[i]
not understand see this b[5]=11,b[4]=9,b[3]=8,b[2]=7,b[1]=3,b[0]=2
Don't forget this is the key for writing sorting order
Order in this way:
Display in Ascending Order:a=["9","8","3","2","8","11","7"]
for(i=0;i<=4;i++)
{
document.write(b[i]);--->out put in this order 2,3,7,8,9,11
}
Also,If u want display in Descending Order this code will help you how
for(i=4;i>=0;i--)
{
document.write(b[i]);--->Out put is 11,9,8,7,3,2
}
----------------------------------------------------------------------------------
Next you can change below code in your environment(c,c++,c#,java,Google Apps)
By understanding above algorithum you came to know that how to implement algorithums
Authour:I will teach you courses online
C Language | C++ | Asp.net | VB.net | Oracle | Hardware and Networking | MCSE |
Contact: | Name: Shrinivas | Mobileno:919703619391 | E-mail: vas.shrinivas002@gmail.com |
No comments:
Post a Comment