Qbasicnews.com
April 03, 2020, 08:05:26 AM
 Pages: [1]
 Author Topic: Quick Sort  (Read 2101 times)
david9c
New Member

Posts: 2

 « on: March 28, 2004, 02:17:48 PM »

Quick Sort

Where can I find a text description of the logic for quicksort?

I have two sample programs that sort an array, but I'm
interested in sorting random access files, large files.

d12connelly@yahoo.com
 Logged
whitetiger0990
__/--\__

Posts: 2964

 « Reply #1 on: March 28, 2004, 04:22:50 PM »

http://forum.qbasicnews.com/viewtopic.php?t=1937

it's basically
Code:
If a(x) > a(x+1) then swap a(x), a(x+1)

it checks the variable to the next one and swaps them if bigger.
 Logged

[size=10]Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.[/size]
Zack
*/-\*

Posts: 3974

 « Reply #2 on: March 28, 2004, 05:05:04 PM »

Wha-? That's a Bubble Sort you're talking about, WT. Quicksort is a lot different, and a lot faster.
 Logged

f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Agamemnus
x/ \z

Posts: 3491

 « Reply #3 on: March 28, 2004, 05:16:00 PM »

Plus, it's full of spelling errors.

http://forum.qbasicnews.com/viewtopic.php?t=4545&highlight=quicksort
 Logged

Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
whitetiger0990
__/--\__

Posts: 2964

 « Reply #4 on: March 28, 2004, 06:45:12 PM »

Quote from: "Zack"
Wha-? That's a Bubble Sort you're talking about, WT. Quicksort is a lot different, and a lot faster.

:shifty: *Stab and run*
 Logged

[size=10]Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.[/size]
Agamemnus
x/ \z

Posts: 3491

 « Reply #5 on: March 29, 2004, 10:43:01 AM »

Um, you can come back now.

There is quicksort stuff in there.

You'll have to serve some e-time for e-stabbing Zack though. (I believe he has already e-bled to e-death.)
 Logged

Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Moneo
Na_th_an

Posts: 1971

 « Reply #6 on: April 09, 2004, 10:35:47 PM »

Quote from: "david9c"
....Where can I find a text description of the logic for quicksort?

I have two sample programs that sort an array, but I'm
interested in sorting random access files, large files....

When you talk about Quicksort, Bubble Sort, etc., you're talking about internal or memory sorts. The best implementation of Quicksort that I've seen is fully detailed in Ethan Winer's book which you can download free from: www.ethanwiner.com
He's a famous QB expert.

Now, when you talk about sorting files, that's another thing entirely which takes you into the big leagues. Very few programmers have actually gotten into the subject of file sorts. If you really need to do files sorts, and think that you will need this in the future, my recommendation is to spend \$149 for the best file sort utility that I have ever seen, from: www.opttech.com
I've been using it for 19 years. It's blazing fast and bullet-proof. The opttech people have been in business for 20 years doing nothing else but sort utilities. Once you have it, you will find many uses for it, including calls to internal or memory sorts. Take a look at their site.
P.S. Writing your own file sort will become a monster project, plus you need to know the theory.
*****
 Logged
*/-\*

Posts: 3655

 « Reply #7 on: April 09, 2004, 11:57:49 PM »

I believe he was actually referring to sorting the records inside a random access file, not actually sorting the file order on the disk...
 Logged

I'd knock on wood, but my desk is particle board.
Moneo
Na_th_an

Posts: 1971

 « Reply #8 on: April 10, 2004, 12:31:37 AM »

Right, Adosorken, could be. Let's see what he has to say.
*****
 Logged
 Pages: [1]