b27b
Replies to this thread:

More by b27b
What people are reading
Subscribers
Subscribers
[Total Subscribers 1]

daum
:: Subscribe
Back to: Kurakani General Refresh page to view new replies
 is there anyone who can sort this using quick sort
[VIEWED 8944 TIMES]
SAVE! for ease of future access.
Posted on 10-14-10 12:48 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

3,1,4,1,5,9,2,6,5,3,5
 
Posted on 10-14-10 1:25 PM     [Snapshot: 20]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Are you talking about excel or other specific program?

 
Posted on 10-14-10 1:31 PM     [Snapshot: 26]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

not in excel bud. I actually need on quick sort diagram.
 
Posted on 10-14-10 3:26 PM     [Snapshot: 74]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Sorry double post.
Last edited: 14-Oct-10 03:26 PM

 
Posted on 10-14-10 3:26 PM     [Snapshot: 74]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Grabbing the pseudocode from wikipedia: 

function
quicksort(array)
     
var list less, greater
     
if length(array) 1  
         
return array  
     
select and remove a pivot value pivot from array
     
for each x in array
         
if x pivot then append x to less
         
else append x to greater
     
return concatenate(quicksort(less), pivot, quicksort(greater))

iteration 1
Choose any pivot, for instance, 3 looks good then
(1,1,2,3)  3 (4,5,9,6,5,5)

iteration 2
Chosing 2 as pivot, and 5 as pivot
(1,1) (2) (3) 3 (4,5,5) 5 (6,9)

Third iteration, chosing random pivot as usual
(1) (1) 2 (3) 3 (4,5) 5 5 (6)(9)

Last iteration:
1 1 2 3 3 4 5 5 5 6 9

I hope I am right and I hope it helps. :)




 
Posted on 10-14-10 3:45 PM     [Snapshot: 110]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

From http://en.wikipedia.org/wiki/Quicksort


You can replace ur numbers to following diagram

 
Posted on 10-15-10 3:00 AM     [Snapshot: 244]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 



This should give you the concept. Yellow bg indicates May Not Require This Step/Possibly wrong. Red int indicates the selection of the partition point ( starting at right -- pivot). underlined is the position where it is sorted.  { } =selection of block . When block has one element, it is sorted already. Bold int= upcoming pivot

 


Please Log in! to be able to reply! If you don't have a login, please register here.

YOU CAN ALSO



IN ORDER TO POST!




Within last 7 days
Recommended Popular Threads Controvertial Threads
I hope all the fake Nepali refugee get deported
Those who are in TPS, what’s your backup plan?
Travel Document for TPS (approved)
MAGA and all how do you feel about Trumps cabinet pick?
NOTE: The opinions here represent the opinions of the individual posters, and not of Sajha.com. It is not possible for sajha.com to monitor all the postings, since sajha.com merely seeks to provide a cyber location for discussing ideas and concerns related to Nepal and the Nepalis. Please send an email to admin@sajha.com using a valid email address if you want any posting to be considered for deletion. Your request will be handled on a one to one basis. Sajha.com is a service please don't abuse it. - Thanks.

Sajha.com Privacy Policy

Like us in Facebook!

↑ Back to Top
free counters