[Show all top banners]

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 7666 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 60 days
Recommended Popular Threads Controvertial Threads
What are your first memories of when Nepal Television Began?
TPS Re-registration case still pending ..
मन भित्र को पत्रै पत्र!
TPS Work Permit/How long your took?
emergency donation needed
काेराेना सङ्क्रमणबाट बच्न Immunity बढाउन के के खाने ?How to increase immunity against COVID - 19?
Guess how many vaccines a one year old baby is given
अमेरिकामा बस्ने प्राय जस्तो नेपालीहरु सबै मध्यम बर्गीय अथवा माथि (higher than middle class)
चितवनको होस्टलमा १३ वर्षीया शालिन पोखरेल झुण्डिएको अवस्था - बलात्कार पछि हत्याको शंका - होस्टेलहरु असुरक्षित
Travelling to Nepal - TPS AP- PASSPORT
Nepali doctors future black or white usa ?
ढ्याउ गर्दा दसैँको खसी गनाउच
Morning dharahara
Another Song Playing In My Mind
nrn citizenship
TPS Renewal Reregistration
WHAT DO YOU GUYS THINK ABOUT THIS?
हेर अमेरिकामा नेपालीहरुको बेज्जत
Alert: Turbo Cancers: A Rising Global Threat
Does the 180 day auto extension apply for TPS?
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