Download Shareware and Freeware Software for Windows, Linux, Macintosh, PDA

line Home  |  About Us  |  Link To Us  |  FAQ  |  Contact

Serving Software Downloads in 956 Categories, Downloaded 50.238.998 Times

THE FASTEST WAY TO SORT N NUMBERS: sortN library 1.0

  Date Added: July 07, 2013  |  Visits: 632

THE FASTEST WAY TO SORT N NUMBERS: sortN library

Report Broken Link
Printer Friendly Version


Product Homepage
Download (51 downloads)



Have you ever thought about the fastest way to sort N numbers?Last week I wrote a post about the fastest way to sort 3 numbers, this week I show you a tricky way to optimize the sort of N numbers.The problem of sorting an array of numbers is probably the most studied in computer science. The efficiency of a sort algorithm depends essentially on the number of comparisons and swaps it needs to reach the solution. This post contains an optimized sort algorithm for small buckets (to my knowledge the fastest).Currently most of sorting algorithms uses quick sort for large buckets and insertion sort for smaller ones. Both these algorithms uses an optimized way to swaps and compare numbers. The sortN library is a further optimization of this operations. It does first all the needed comparisons and then, only in the end, it swaps values to reach the sorted solution only in the end. It is in practice an enhanced Insertion sort algorithm.The sortN libraryThe library is written in C++, but it can be written in any code, and supports arrays up to 7 elements. It can be applied , in theory, to array of any size but we will see this can not be realized in practice, only small arrays can be sorted.The sortN libary can be considered enhanced insertion sort algorithm.It contains a list of optimized function to sort 3,4,5,6,7 values. Each function is optimized to sort an N number of values.Here is the approach to the solution:N numbers can be disposed in Nc combinations where Nc is N!.We may think to write a recursive code that reach the sorted solution in the way algorithms for permutations does.The permutations represents all the possible solutions, depending on the value of each comparison (between 2 values of the array) a permutation is chosen or refused.This allows, depending on the results of the comparisons, to build a decisionary tree that unequivocally leads to the permutation that represents the solution. Once we know the solution we can optimize swaps to reach it.Notice that no swaps must be done done before we know the exact solution. This can be considered an enhanced insertion sort algorithm.The number of comparisons possible are great even for a relative small array, we can not think about writing by hand the code, we need some function to do job for us. Thatd-deOaos what the sort library does, it prints the enhanced insertion sort algorithm.There is a small disadvantage: the problem has size N!. It becomes huge for relative small buckets like 8 numbers. The sort8 function requires a 10MB file, I waited10 minutes for the compiler to build it, but no success, then I give up and decide to use the library till sort7 function.The sortN functionYou probably got confused, so here it is the code that I hope will clarify the concept.The sort N function is a MATLAB script that prints the enhanced insertionsort algorithm for N values.It recursively finds all the solutions and it prints optimized swaps.

Requirements: No special requirements
Platforms: Matlab
Keyword: Algorithm Algorithm Depends Algorithmit Algorithms Algorithmthe Number Algorithmthe Sortn Algorithmthere All The Array Clarify Depending Enhanced File Optimized Sort Thought Values Will See This Writing
Users rating: 0/10

License: Freeware Size: 10 KB
USER REVIEWS
More Reviews or Write Review


THE FASTEST WAY TO SORT N NUMBERS: SORTN LIBRARY RELATED
Development Tools  -  N-DIMENSIONAL CONVEX HULL: QUICKER HULL ALGORITHM 1.0
The Matlab convhulln is a gateway to the quickhull algorithm ( see www.qhull.org ). In my opinion, one weak point of this mex routine is that it processes all the points without performing any preliminary filtering.In many cases it would be faster...
10 KB  
Development Tools  -  Lunar Azimuth and Altitude Estimation Algorithm 1.0
This algorithm will accept a Latitude, Longitude and Altitude location as well as a specific universal coordinated time. It will use this information and calculate the position of the moon in a local coordinate frame (az and alt aka az and...
10 KB  
Development Tools  -  Nearest Neighbor algorithm for the Travelling Salesman Problem 1.0
The 2-column vector contains cities' coordinates. The algorithm generates the optimal path to visit all the cities exactly once, and return to the starting city.The algorithm has its limitations, and based on the cities' distribution on the map it...
10 KB  
Calculators  -  Random Number Software 1.0
Random number Software is an powerful & easy to operate program to generate a list of random numbers. Random number Software is cultivated on windows platform, software supported on all the Windows OS versions. Software also provides you the...
960.41 KB  
Multimedia & Graphics  -  FPgrowth 4.40
FPgrowth is a simple, tiny application that will help you find frequent item sets (also closed and maximal) with the fpgrowth algorithm (frequent pattern growth, Han et al 2000), which represents the transaction database as a prefix tree which is...
 
Education  -  MB Cornerstone Number 1.0
MB Cornerstone Number Software finds your cornerstone number or the cornerstone letter and also lets you know the significance of your cornerstone number or your cornerstone letter. The explanation, rather the interpretation of your cornerstone...
624 KB  
Development Tools  -  lobpcg.m 1.0
[blockVectorX,lambda]=lobpcg(blockVectorX,operatorA)outputs the array of algebraic smallest eigenvalues lambda andcorresponding matrix of orthonormalized eigenvectors blockVectorX of the Hermitian (full or sparse) operator operatorA using input...
10 KB  
Promotion Tools  -  Cute Web Phone Number Extractor Advance 2.7.4
The "Cute Web Phone Number Extractor Advance" is an easy-to-use, fast and result-oriented telephone number extractor software. It can extract telephone/mobile/fax number extractor along with user/company name from internet/website/local files. The...
3.09 MB  
Word Processing  -  KMB Text Compare 1.0
KMB Text Compare implements a diff algorithm to compare any type of file containing text or values. Each matching line is set side by side, if a different line is detected, it is offset and indicated when the cell is filled in. The user can...
919 KB  
Libraries  -  libmcrypt 2.5.8
libmcrypt is the library which implements all the algorithms and modes found in mcrypt. libmcrypt library is currently under development but it seems to work pretty good. Unlike most encryption libraries libmcrypt does not have everything...
522.24 KB  
NEW DOWNLOADS IN SCRIPTS, DEVELOPMENT TOOLS
Scripts  -  Free Ecommerce website creator 1.2
Free Ecommerce website creator is a free PHP shop creating script. This allows you to put a online shop on your own website. Create your own free ecommerce website for Your Business. Create an online shop using easyGUI online shop creator. The...
1.44 KB  
Scripts  -  MochiGames PHP Script ZDR 1.00
MochiGames PHP Script ZDR is web site, ready for use, for flash games. These flash games are downloaded automatically by "MochiGames PHP Script ZDR" from MochiGames media. The use of the games is free, you can use your own Mochi Publisher ID and...
368.54 KB  
Scripts  -  Php Chat 2.0
Add a free php site, single sign-on and multiple skins, 100% free 1. Server Modes: The chat server has paid mode and free mode. If the free chat mode, a free chat room will be assigned to your website with your domain as the room name. 2....
938.87 KB  
Scripts  -  Nibbleblog 3.0.1
Nibbleblog it's a powerful engine for creation and manipulation of BLOG's completely free. Very simple to install and configure (Only 1 step). The database used is based on XML files and this way it is not necessary to use MySQL or similar DBMS....
371.09 KB  
Scripts  -  PHP File Manager | CloudOsys 2.9b8
CloudOsys is a PHP file manager, a tool that allows your visitors upload files such as media content directly to your website. Your visitors will upload files directly to your website, where they can share and comment on them. Through cloud...
1.41 MB  
Development Tools  -  Aml2CHM 3.50
Those who use the popular Aml Pages text editor might be looking out for a way of generating help files from their text and notes. Aml2CHM is a plug-in that was developed to offer people a quick and efficient way of converting Aml Pages documents...
549.99 KB  
Development Tools  -  VMP Viewer 1.0
This is a very rudimentary tool to visualize the VMP files generated by BrainVoyager. Useful to share files with people who do not have BV.
10 KB  
Development Tools  -  7-Zip for Script 4.42
7-Zip is a file archiver with a high compression ratio.Features:- High compression ratio in new 7z format with LZMA compression- Supported formats:- Packing / unpacking: 7z, ZIP, GZIP, BZIP2 and TAR- Unpacking only: RAR, CAB, ISO, ARJ, LZH, CHM,...
624.64 KB  
Development Tools  -  PHP Docbook Displayer for Scripts 1.0b
PHP Docbook Displayer provides XSL and CSS stylesheets, and PHP scripts, to generate easily and dynamically websites from Docbook files.It aims at simplifying to the max the web publication process : simply drop the docbook file under the site root !
102.4 KB  
Development Tools  -  WP Translate 1.0
This simple language translation plugin allows your users to quickly translate your webpages, through a widget on your blog.You have the option to select the title of the Widget, which will be displayed above the language translation form. Users...
10 KB