Upcoming SlideShare
×

# Merge Sort Algorithm

1,012 views

Published on

Demonstration of Merge Sort Algorithm by an example

1 Like
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

Views
Total views
1,012
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
45
0
Likes
1
Embeds 0
No embeds

No notes for slide

### Merge Sort Algorithm

1. 1. Merging <ul><li>Merge. </li></ul><ul><ul><li>Keep track of smallest element in each sorted half. </li></ul></ul><ul><ul><li>Insert smallest of two elements into auxiliary array. </li></ul></ul><ul><ul><li>Repeat until done. </li></ul></ul>auxiliary array smallest smallest A A G L O R H I M S T
2. 2. Merging <ul><li>Merge. </li></ul><ul><ul><li>Keep track of smallest element in each sorted half. </li></ul></ul><ul><ul><li>Insert smallest of two elements into auxiliary array. </li></ul></ul><ul><ul><li>Repeat until done. </li></ul></ul>auxiliary array A G smallest smallest A G L O R H I M S T
3. 3. Merging <ul><li>Merge. </li></ul><ul><ul><li>Keep track of smallest element in each sorted half. </li></ul></ul><ul><ul><li>Insert smallest of two elements into auxiliary array. </li></ul></ul><ul><ul><li>Repeat until done. </li></ul></ul>auxiliary array A G H smallest smallest A G L O R H I M S T
4. 4. Merging <ul><li>Merge. </li></ul><ul><ul><li>Keep track of smallest element in each sorted half. </li></ul></ul><ul><ul><li>Insert smallest of two elements into auxiliary array. </li></ul></ul><ul><ul><li>Repeat until done. </li></ul></ul>auxiliary array A G H I smallest smallest A G L O R H I M S T
5. 5. Merging <ul><li>Merge. </li></ul><ul><ul><li>Keep track of smallest element in each sorted half. </li></ul></ul><ul><ul><li>Insert smallest of two elements into auxiliary array. </li></ul></ul><ul><ul><li>Repeat until done. </li></ul></ul>auxiliary array A G H I L smallest smallest A G L O R H I M S T
6. 6. Merging <ul><li>Merge. </li></ul><ul><ul><li>Keep track of smallest element in each sorted half. </li></ul></ul><ul><ul><li>Insert smallest of two elements into auxiliary array. </li></ul></ul><ul><ul><li>Repeat until done. </li></ul></ul>auxiliary array A G H I L M smallest smallest A G L O R H I M S T
7. 7. Merging <ul><li>Merge. </li></ul><ul><ul><li>Keep track of smallest element in each sorted half. </li></ul></ul><ul><ul><li>Insert smallest of two elements into auxiliary array. </li></ul></ul><ul><ul><li>Repeat until done. </li></ul></ul>auxiliary array A G H I L M O smallest smallest A G L O R H I M S T
8. 8. Merging <ul><li>Merge. </li></ul><ul><ul><li>Keep track of smallest element in each sorted half. </li></ul></ul><ul><ul><li>Insert smallest of two elements into auxiliary array. </li></ul></ul><ul><ul><li>Repeat until done. </li></ul></ul>auxiliary array A G H I L M O R smallest smallest A G L O R H I M S T
9. 9. Merging <ul><li>Merge. </li></ul><ul><ul><li>Keep track of smallest element in each sorted half. </li></ul></ul><ul><ul><li>Insert smallest of two elements into auxiliary array. </li></ul></ul><ul><ul><li>Repeat until done. </li></ul></ul>auxiliary array first half exhausted A G H I L M O R S smallest A G L O R H I M S T
10. 10. Merging <ul><li>Merge. </li></ul><ul><ul><li>Keep track of smallest element in each sorted half. </li></ul></ul><ul><ul><li>Insert smallest of two elements into auxiliary array. </li></ul></ul><ul><ul><li>Repeat until done. </li></ul></ul>auxiliary array first half exhausted A G H I L M O R S T smallest A G L O R H I M S T
11. 11. Merging <ul><li>Merge. </li></ul><ul><ul><li>Keep track of smallest element in each sorted half. </li></ul></ul><ul><ul><li>Insert smallest of two elements into auxiliary array. </li></ul></ul><ul><ul><li>Repeat until done. </li></ul></ul>auxiliary array first half exhausted second half exhausted A G H I L M O R S T A G L O R H I M S T