ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I would use a merge sort or a quick sort personally, but performance is highly dependant on how the data happens to fall.
I've found in real world performance the bubble sort rarely, if ever, will touch the performance of merge sort or quick sort, though I'm sure with some specifically structured datasets we could show bubble sort to be quite fast.
Your best solution:
try a known C library function like qsort, first. You are less likely to have problems later on. qsort has been beat on for 15+ years. Most of the problems have long since been chased out.
Test it on real data, not programmer data. If it works okay, don't worry about squeezing an extra five seconds off run-time. It is not worth your time.
If you are in a big production environment, look for commercial libraries like syncsort. Don't try to write a linear time sort on your own.
IE. Theres 20 numbers and the first 15 are sorted but the remaining 5 are still jumbled.
In reality it might be the first 99% of them are sorted, or something like that. I'm not in a big production enviornment, so I can't afford commercial licences.