All source code in Visual Basic Ask a Visual Basic Pro Discussion Forum Categories All jobs in Visual Basic
809K,ONE,SORT,CAN,illustrate,high,efficiency,
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
Visual Basic Stats

 Code: 5,128,645. lines
 Jobs: 275. postings

 How to support the site

 
Sponsored by:
Quick Search for:  in language:    
You are in:
 
Login





Latest postings for Visual Basic.
Click here to see a screenshot of this code!Resistor Color Code
By Ferdinand Viray on 2/7

(Screen Shot)

Click here to see a screenshot of this code!Database - Student Reccord
By Ferdinand Viray on 2/7

(Screen Shot)

Click here to see a screenshot of this code!Online Text Based Winsock Crime Game | Mafia Game
By William Hughes on 2/7

(Screen Shot)

Click here to see a screenshot of this code!NZB Reader III
By Ed Wilk on 12/29

(Screen Shot)

Click here to see a screenshot of this code!Jobz Tracker
By Andy J Spry on 2/6

(Screen Shot)

Click here to see a screenshot of this code!Database - Student Reccord
By Ferdinand Viray on 2/6

(Screen Shot)

Click here to see a screenshot of this code!Resistor Color Code
By Ferdinand Viray on 2/6

(Screen Shot)

a simple program (database)
By Jenilyn Brena on 2/6


Click here to see a screenshot of this code!Multipass BILATERAL FILTER. (V3.3)
By reexre on 1/12

(Screen Shot)

Click here to see a screenshot of this code!Completely hide taskbar in vista and seven.
By Alexander G on 2/5

(Screen Shot)

Binding DataGrid to ADODC
By kývanç ; on 2/5


Book Record
By kývanç ; on 2/5


VB6 to VB.NET Guide
By brandon teoh on 2/5


Easy dsr datareport
By Manuel Matamoros on 2/4


Click here to see a screenshot of this code!Manual RAID 1 v2.0.11
By Mike Morrow on 1/11

(Screen Shot)

Rotate Text Pure Vb, No Dll, No Api
By ivan pausich on 2/4


Click here to see a screenshot of this code!MediaVusion; A Powerful Media Player
By xvader on 2/4

(Screen Shot)

Click here to see a screenshot of this code!PSC Zip Store and read
By Kenneth Foster on 2/3

(Screen Shot)

Click here to see a screenshot of this code!Linear Power Supply Designer
By RandyT_CS on 2/3

(Screen Shot)

retrieve (get) all system services
By milad ghafooreyan on 2/3


Click here to see a screenshot of this code!easy inventory manager
By ravi vaghela on 2/3

(Screen Shot)

Click here to see a screenshot of this code!A simple Calculater in Vb 6
By Varun Naharia on 2/2

(Screen Shot)

Click here to see a screenshot of this code!Special Folder Locator
By dreamvb on 2/2

(Screen Shot)

Click here to see a screenshot of this code!material viewer system
By Donald Paras on 2/2

(Screen Shot)

Click here to see a screenshot of this code!Solid Lathe Simulation
By Eduardo Capatto Júnior on 2/1

(Screen Shot)

Click here to see a screenshot of this code!A simple Calculater in Vb 6
By Varun Naharia on 1/31

(Screen Shot)

Click here to see a screenshot of this code!Final Fantasy 3D game
By Yazan Markabi on 1/31

(Screen Shot)

Click here to see a screenshot of this code!Time Up 3
By Yazan Markabi on 1/19

(Screen Shot)

RFID receiver
By Nikolay Veskov on 1/31


Library Information Syste
By Eduard Dueñas on 1/31


Click here to see a screenshot of this code!Sales and Inventory
By Eduard Dueñas on 1/30

(Screen Shot)

Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!



 
 
   

Comb Sort/Merge

Print
Email
 
winzip icon
Submitted on: 5/1/2007 5:36:54 PM
By: Mike Morrow  
Level: Beginner
User Rating: By 2 Users
Compatibility:VB 6.0

Users have accessed this code 6331 times.
 
(About the author)
 
     To illustrate the high efficiency of comb sort, a very wrongly overlooked sort method. Sorts 809K records (40 bytes each) in 48 seconds on a 2GHz Athlon. It runs faster than some Quicksort implementation and does not do any recursion. Quicksort performs poorly in a heavily paged environment. Sorting a large file can create such an environment causing its own longer than needed execution times. Comb Sort does not recurse and, therefore, runs with lowered system demands. Recursion causes additional system memory utilization contending with the data to be sorted. This program illustrates the increased efficiency of sorting in segments then merging the sorted groups into the output dataset. Merging the segments takes a tiny amount more code but it still linear, not recursive. Input is any file of data. The data (in this implementation) must be fixed length. This is a general purpose routine but can be very easily modified if required for other sorting tasks. Primary effect is a sorted file. Side effect is possible paging system usage if the data file is very large. This program easily handles file of 10 million records which, in my case, is about 340 MB of data. It reads in the entire file, sorts it in stages, in memory, then merges the sorted groups to the output dataset. It is odd how many people think that Quicksort it the best general purpose method for sorting and leave it at that. Quicksort has some very high penalties (nearly sorted files for one) and is best when not run to completion but handed over to another type of sort to finish up the busywork such as bubble sort. What a mess, two sort routines to accomplish ONE SORT! Yes, BUBBLESORT can be quite efficient in certain cases such as a backend for Quicksort. CombSort is better than all of that, is a single routine and does not have the high overhead of recursion for millions of levels. It is a simple routine without any recursion at all. A paging environment is hostile to Quicksort but far kinder to comb sort. Updated on 12/19/04 for better variable record length performance. Some folks said that I must have been using a horrible quicksort implementation. Turns out that I was using one that someone had not optomized. With complex optimizations, quicksort CAN run faster than combsort but can also run SLOWER than combsort. Depends on the data. Combsort is much more predictable and "stable" in that it runs in about the same amount of time every time and that is a short amount of time, every time. Look on the web for the origins and operational theory of combsort. It is my favorite now. I recommend it for all situations. Be sure to NOT change the gaps table. It is optimized already. Changing it can double of triple run times. Enjoy.

 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.

Virus note:All files are scanned once-a-day by Planet Source Code for viruses,but new viruses come out every day, so no prevention program can catch 100% of them.

FOR YOUR OWN SAFETY, PLEASE:
1)Re-scan downloaded files using your personal virus checker before using it.
2)NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
3)Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
1) You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.   
2) You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 23 submission(s) by this author

 

 
 Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:
 
Your Vote!

What do you think of this code(in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments
2/4/2005 1:40:27 PMMike Morrow

This code has been updated to sort any length records. However, the sort fields must add up to the total length of the record or data will be lost. If that is the intent, then good, you can sort and reformat (extract data) from files. This working EXAMPLE sorts in descending order. Some day, I hope to add a selection of order direction and not have to use the entire record as the "key". Don't hold your breath!
(If this comment was disrespectful, please report it.)

 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author from the email account you registered on the site, so you can correspond directly.

NOTICE: The author of this code has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular code, please click here.
 
To post feedback, first please login.


 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Games | Feedback | Customize | Visual Basic Home | Site Home | Other Sites | Open Letter from Moderators | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997-2010 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.   Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.