• Best of luck to the class of 2024 for their HSC exams. You got this!
    Let us know your thoughts on the HSC exams here
  • YOU can help the next generation of students in the community!
    Share your trial papers and notes on our Notes & Resources page
MedVision ad

Bubble Sorting !!!! (1 Viewer)

Moulieg

New Member
Joined
Nov 29, 2006
Messages
11
Gender
Male
HSC
2007
Anyone with information about bubble sorting, like flowcharts, vb programs, anything !! i would really appreciate any info on it, thnkas

Moulieg
 

ianc

physics is phun!
Joined
Nov 7, 2005
Messages
618
Location
on the train commuting to/from UNSW...
Gender
Male
HSC
2006
get the excel book - its got excellent explanations and pseudocode for all 3 of the sorting types: bubble, selection and insertion.

otherwise google around and see what you can find: i found some simple vb code:
http://www.codecodex.com/wiki/index.php?title=Bubble_sort#VBA

also have a look at some of the sdd resources on this site - there might be some good stuff in there.


sorts are probably the most fiddly things you will have to do in software - and unfortunately i can guarantee you that you will either have to interpret or write a searching/sorting algorithm in every exam you do. So it is important you make the effort to understand them.....

Good luck with it!
 

MaNiElla

Active Member
Joined
Feb 19, 2007
Messages
1,853
Gender
Undisclosed
HSC
N/A
Bubble sort compares two items at a time and swaps them if they are in the wrong order.

bubble sort in pseudocode is as follows:

Code:
procedure bubbleSort( A : list of sortable items ) defined as:
  do
    swapped := false
    for each i in 0 to length( A ) - 2 do:
      if A[ i ] > A[ i + 1 ] then
        swap( A[ i ], A[ i + 1 ] )
        swapped := true
      end if
    end for
  while swapped
end procedure
Worst-case performance: when the smallest element is at the end of the list

Best-case performance: When a list is already sorted

I hope this helps :)
 
Last edited:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top