Web Design, Development & Marketing
acuras services: Website Design & Development E-commerce Solutions Content Management Systems Online Marketing & Social Media Corporate Branding Social Media Training
Get in touch... Email Us: info@acuras.co.uk
acuras blog:7 Quick Tips to Keep Your SEO On Track in 2012 7 Social Media & SEO Tactics Businesses Will Adopt in 2012 latest posts:We are now trading as a Limited company Recent Work: Digital Marketing Material and Website Re-Designs Affordable Web Hosting and Domain Name Registration New Acuras Logo Coming Soon... Barclaycard ePDQ CPI Integrations HSBC XML API / CPI E-commerce Integrations Photoshop to Valid XHTML/CSS Coding Service Recommended Open Source Invoicing System Reasons Businesses should Embrace the Web blog archive:
Web Development ArticlesJava: Merge Sort Algorithm Analysis and Code
Published: 5th Apr 2006
The Merge Sort is a recursive “divide and conquer” algorithm which involves merging two sorted lists with each other each step of the algorithm. As with the insertion sort, a single element is viewed as a sorted list therefore the Merge Sort breaks down a list into individual elements, all of which are “sorted” lists in themselves, which can be merged with other sorted lists. In the example of an unsorted list of 4 elements, each of the elements will be separated from each other. Then, the first step of the algorithm will merge the first two elements together so that they are in order. Then the 3rd and 4th elements will be merged. This leaves two sorted lists of 2 elements each. These two lists can then be merged, resulting in the 4 elements being sorted in a single list. The time complexity of the Merge Sort is O(N log(N)). The Merge Sort is a relatively fast algorithm but it has the disadvantage of requiring a large amount of memory due to its recursive nature.
Related LinksRelated Articles / PostsJava: Quick Sort Algorithm Analysis (13/06/2006) Java: Merge Sort Algorithm Analysis and Code (05/04/2006) Java: Random Array Generator (29/03/2006) Java: Insertion Sort Algorithm Analysis and Code (29/03/2006) Java: Binary Search Algorithm Analysis and Code (29/03/2006) |
||