Merge sort, Data Structure & Algorithms

Merge sort is a sorting algorithm which uses the basic idea of divide and conquers. This algorithm initially divides the array into two halves, sorts them separately and then merges them together again. This method is recursive, with the base criterion-the number of elements in the array is not more than 1. Let us suppose variable low and high represents the index of the first and last element of the array respectively, the merge sort can be defined recursively as follows

If(low

Divide the list into two halves Mergesort the left half Mergesort the right half

Mergesort the two sorted halves into one sorted list

Endif.

 

 

Posted Date: 7/10/2012 3:32:11 AM | Location : United States







Related Discussions:- Merge sort, Assignment Help, Ask Question on Merge sort, Get Answer, Expert's Help, Merge sort Discussions

Write discussion on Merge sort
Your posts are moderated
Related Questions
The time required to delete a node x from a doubly linked list having n nodes is O (1)

need an expert to help me with the assignment


What will be depth do , of complete binary tree of n nodes, where nodes are labelled from 1 to n with root as node and last leaf node as node n

Implement a linear-expected-time algorithm for selecting the k th smallest element Algorithm description 1. If |S| = 1, then k = 1 and return the element in S as the an

Q. Enumerate number of operations possible on ordered lists and arrays.  Write procedures to insert and delete an element in to array.

The  total  of  time  needed  by  an algorithm to run to its completion is termed as time complexity. The asymptotic running time of an algorithm is given in terms of functions. Th

Give the example of bubble sort algorithm For example List: - 7 4 5 3 1. 7 and 4 are compared 2. Since 4 3. The content of 7 is now stored in the variable which was h

Program gives the program segment by using arrays for the insertion of an element to a queue into the multiqueue. Program: Program segment for the insertion of any element to t

This notation bounds a function to in constant factors. We say f(n) = Θ(g(n)) if there presents positive constants n 0 , c 1 and c 2 such that to the right of n 0 the value of f