bubble sort

This is a discussion on bubble sort within the C Programming forums, part of the General Programming Boards category; Hi, In one hour, it's my final exam. To be ready, I would greatly appreciate if someone could show me ...

  1. #1
    Registered User
    Join Date
    Mar 2007
    Posts
    42

    bubble sort

    Hi,

    In one hour, it's my final exam. To be ready, I would greatly appreciate if someone could show me an example of the bubble sort to sort an array that contain a structure. If for example, I have a struct that contain a number (int), a name and a phone number, how do I use bubble sort to sort all the numbers, with the names and the phones numbers following.

    Thanks
    (don't worry with my noob posts, it's surely my last)

  2. #2
    The larch
    Join Date
    May 2006
    Posts
    3,573
    The internet is full of examples of bubble-sort.

    If you understand bubble-sort, making it sort array of structs simply means that you don't compare simple types but a data member of the struct.
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 05-13-2009, 04:25 PM
  2. Bubble Sort... which type?
    By gflores in forum C++ Programming
    Replies: 8
    Last Post: 08-15-2004, 05:48 AM
  3. Bubble Sort, Qucik Sort
    By insomniak in forum C Programming
    Replies: 2
    Last Post: 03-15-2003, 04:54 PM
  4. optimizing bubble sort
    By Sargnagel in forum C Programming
    Replies: 14
    Last Post: 01-23-2003, 06:27 AM
  5. Help with Bi-Directional Bubble Sort in C
    By cunninglinguist in forum C Programming
    Replies: 0
    Last Post: 04-19-2002, 03:32 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21