•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 425,963 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,676 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser: Programming Forums
Views: 1277 | Replies: 4
![]() |
Assuming you're supposed to write your own, rather than use the standard C++
You'll find pseudocode for these here
http://en.wikipedia.org/wiki/Bubble_sort
http://en.wikipedia.org/wiki/Selection_sort
sort function, You'll need to implement a sort algorithm. a bubble sort or a selection sort should be fairly easy to write.You'll find pseudocode for these here
http://en.wikipedia.org/wiki/Bubble_sort
http://en.wikipedia.org/wiki/Selection_sort
Last edited by Bench : Feb 10th, 2008 at 11:04 am.
¿umop apisdn upside down? •
•
Join Date: Jul 2005
Posts: 1,157
Reputation:
Rep Power: 9
Solved Threads: 150
There are any number of ways to sort an array. Some of them are called bubble sort, qsort, sort(), merge sort, selection sort, etc. Each has their attractions and detractions. For arrays of relatively small size the bubble sort seems to be very popular with beginning programers because of the "simplicity" of implementation. The basic principle of bubble sort is to compare each element of the array, starting the index 0, with every other element in the array and swapping them if the desired criteria is satisfied.
Last edited by Lerner : Feb 10th, 2008 at 11:05 am.
•
•
Join Date: Jul 2005
Posts: 1,157
Reputation:
Rep Power: 9
Solved Threads: 150
You can look it up using your favorite search engine. Basically, it means first find the smallest in the array and swap it with the element in the first position, then find the second smallest element and swap it with the element in the second position, and continue in this way until the entire array is sorted.
![]() |
•
•
•
•
•
•
•
•
DaniWeb C++ Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Other Threads in the C++ Forum
- Previous Thread: Quadratic probing insert function help
- Next Thread: Dynamic 2 dimensional array



Linear Mode