• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Implementing Sample sort algorithm

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to implement the samplesort algorithm and would need help since I couldn't find some java code in the internet so I work with the Pseudo Code from Wikepedia. So far I have this Code:

which isn't verry much. My biggest Problem is, that I don't now much about this algorithm and I also don't find much on the internet.
So referring to the Pseudo Code on Wikepedia, I sorted the Samples. In the last step I inplemented my pivot elements with the elements from Sample.
Now I'm stuck. I don't understand how the rest of the pseudo code works because I don't know how to find j.
So somebody could make me very happy if he can help me to finish this algorithm.
 
Ranch Hand
Posts: 1143
1
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are many sorting algorithms. According to what you posted, it looks like you are trying to implement the quicksort algorithm. In my opinion the simplest sorting algorithm to understand is the bubble sort. In any case and contrary to what you claim, I did find Web pages that explain how to implement quicksort in java. Here is a page explaining quicksort in java. Simply google for quicksort java. And here is a page explaining bubble sort. Again simply google for java bubble sort. By the way, in case you are unaware, class java.util.Arrays has several, static sort() methods.
 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Quick Sort Algorithm


 
Hans Peterson
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually I'm not trying to implement the quicksort algorithm. I'm trying to implement this algorithm wich hasn't a verry detailed pseudo code.
reply
    Bookmark Topic Watch Topic
  • New Topic