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
Handout 15 COMP 264: Introduction to Computer Systems (Section 001) Spring 2013 R. I. Greenberg Computer Science Department Loyola University Water TowerCampus, Lewis Towers 524 82

an electrical student designed a circuit in which the impedence in one part of a series circuit is 2+j8 ohms and the impedent is another part of the circuit is 4-j60 ohm mm program

/* The program accepts matrix like input & prints the 3-tuple representation of it*/ #include void main() { int a[5][5],rows,columns,i,j; printf("enter the order of

In file access: what is the difference between serial, sequential and indexed sequential searching

Ordinary variable An ordinary variable of a easy data type can store a one element only

Q1. Define the following terms: (i) Abstract data type. (ii) Column major ordering for arrays. (iii)  Row major ordering for arrays. Q2. Explain the following: (i) A

algorithm and flow chart to find weather the given numbers are positive or negative or neutral

2. Write a note on i) devising ii) validating and iii) testing of algorithms.

solve the following relation by recursive method: T(n)=2T(n^1/2)+log n

The below figure illustrates the BOM (Bill of Materials) for product A. The MPS (Material requirements Planning) start row in the master production schedule for product A calls for