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

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

Serving Software Downloads in 976 Categories, Downloaded 29.541.127 Times

THE FASTEST WAY TO SORT N NUMBERS: sortN library 1.0

  Date Added: July 07, 2013  |  Visits: 300

THE FASTEST WAY TO SORT N NUMBERS: sortN library

Report Broken Link
Printer Friendly Version


Product Homepage
Download (21 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
Music  -  fashiontv show 1.0.0.0
Welcome to FashionTV's YouTube channel, your number #1 channel for all the latest fashion videos, parties, and events. Join us on the front row and backstage at the world's greatest fashion weeks. Meet the models, designers, photographers,...
1024 KB  
Travel  -  Welcome To Goa 1.0.0.0
Goa is a very relaxing and enjoyable place in india.Its is a small state in india.But One of the beautiful place in india.Goa have more number of places that show the beauty of nature.And goa have no of beaches and church ...This application...
1024 KB  
Utilities  -  Toprammer 0.9
Toprammer is an Opensource software for the TOP2049 universal programmer. There's a commandline and GUI (PyQT) tool available. It is written in Python, so it's potentially very portable. It's currently only tested on Linux, but it should run...
296.96 KB  
Games  -  8192 Match Twos: 2048 << 2 1.0
8192 is the newest and latest evolution in the increasingly popular number match games! Similar to the popular 2048 and 1024 games match two games and games matching threes, the goal of this game is to get the largest 4-digit block possible -...
4.4 MB  
Education  -  USAPresidents 1.1.0.0
Learning the USA Presidents has never been easier. USA Presidents is another Windows Phone Application from Streamline Technology. USA Presidents uses five different learning techniques to help you commit to memory the name of each...
6 MB  
Communication  -  K-means algorithm demo 1.0
The k-means algorithm is widely used in a number applications like speech processing and image compression.This script implements the algorithm in a simple but general way. It performs four basic steps.1. Define k arbitrary prototypes from the...
10 KB  
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  
Network & Internet  -  Parallel Genetic Algorithm Library 0.99
Parallel Genetic Algorithm Library (or PGAL for short) is a C++ toolkit for simply, efficiently, and swiftly producing genetic algorithm code that works across multiple processors. This is useful not only for those with multi-processor...
75.78 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  
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  
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  -  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  
Development Tools  -  save2word 1.0
A simple function to copy figure from MATLAB into MS Word automatically. It is a modification of saveppt (a function in File exchange) that save figures to MS Powerpoint.
10 KB