Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
can i have all kind of sort please
Author Message
siczy

Posted: Tue Nov 25, 2003 7:00 pm   Post subject: can i have all kind of sort please

i'm doing a sorting program for Computer Science Class~I need the code for bubble sort,quick sort,inserting sort~please help me~thanks~

AsianSensation

Posted: Tue Nov 25, 2003 7:26 pm   Post subject: (No subject)

bubble sort:

 code: for i : 1 .. n     for j : i .. n + 1     end for end for

where n + 1 is the number of elements in the array that is to be sorted

take that andy
Andy

Posted: Tue Nov 25, 2003 7:28 pm   Post subject: (No subject)

AsianSensation wrote:
bubble sort:

 code: for i : 1 .. n     for j : i .. n + 1     end for end for

nope
should be
 code: for i : 1 .. n - 1     for j : i .. n     end for end for
Tony

Posted: Tue Nov 25, 2003 7:32 pm   Post subject: (No subject)

anyways... Search function is good

Quick sort is more complicated. It has to do with breaking the array in halfs (its a self calling function) and comparing little bits. I dont remember. VB has it already writen for you
Tony's programming blog. DWITE - a programming contest.
AsianSensation

Posted: Tue Nov 25, 2003 8:00 pm   Post subject: (No subject)

just how many types of sorting are there? And which ones are the most efficient?
Andy

Posted: Tue Nov 25, 2003 8:01 pm   Post subject: (No subject)

why sort it? use binary tree!
Tony

Posted: Tue Nov 25, 2003 8:03 pm   Post subject: (No subject)

well there got to be like a dozen of variations of bubble sort

Most efficient is quick-sort.

Dodge - yes... binary tree... here's one for you
 code: void binaryTree () { cout << " 000"; cout << "0000"; cout << " 000"; cout << " 11"; cout << " 11"; }

props to Dauntless for the source code
Tony's programming blog. DWITE - a programming contest.
Andy

Posted: Tue Nov 25, 2003 8:05 pm   Post subject: (No subject)

LOL, i see that derek is getting popular already...

Mazer

Posted: Tue Nov 25, 2003 9:37 pm   Post subject: (No subject)

tony wrote:

Dodge - yes... binary tree... here's one for you
 code: void binaryTree () { cout << " 000"; cout << "0000"; cout << " 000"; cout << " 11"; cout << " 11"; }

lmao, good stuff!
siczy

Posted: Tue Nov 25, 2003 9:38 pm   Post subject: (No subject)

wat bout the inserting sort one?anyone know about that one?
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 1  [ 10 Posts ]
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: