Monday, May 24, 2010

Write a C Program to arrange a set of N numbers in an increasing order?

Write a C Program to arrange a set of N numbers in an increasing order

Write a C Program to arrange a set of N numbers in an increasing order?
This is a standard sort program. You can use bubble sort which is the simplest and inefficient in case of a lot of numbers. You could use insertion sortor merge sort and quick sort. Quick sort is a good choice for large set of numbers. Any algorithms book will tell you how these sorts work. You should refer those and try and code. If you are a beginner then I suggest u learn bubble sort. Its easy to learn and understand.
Reply:The C API has a built in implementation for sorting using quick sort, which is very efficient. The man, page with details on how it works is at:





http://www.hmug.org/man/3/qsort.php





C also provides heap and merge sort built in implementations.

gift baskets

No comments:

Post a Comment