Join Raghavendra Dixit for an in-depth discussion in this video Merge sort: Pseudocode, part of Introduction to Data Structures & Algorithms in Java.
- [Instructor] Now let's look at the pseudocode…for MergeSort.…So here we denote the array as capital A,…and what we are doing here…is that we are saying MergeSort array A from start to end.…And what is the start and end?…Well, they are indexes of the array…representing the part of the array we want to merge sort,…all right?…So basically we don't really…physically break down the array into smaller parts,…rather we do a logical breakdown,…and start and end indices help us keep tab…on which part of the array is being merge sorted,…and just to make it clear,…MergeSort will be called on array A…with the start index as zero and the end index as seven,…because the length of the array A is seven, all right?…Of course, start is less than end,…so we go inside the block of code and calculate the middle,…which will be three.…
Then we call MergeSort recursively on array A,…but only on the first part of the array,…from index zero to three, all right?…Now the next statement will not be executed right away,…because the call will again go to the MergeSort method…
Note: This course was created by Packt Publishing. We are pleased to host this training in our library.
- Why study data structures and algorithms?
- How to calculate the time complexity
- Using Big O notation
- Using basic sorting and search algorithms
- Searching elements in unordered arrays and ordered arrays
- Implementing a linked list in Java
- Implementing stacks using arrays
- Queues using arrays
- Binary search trees
- Representing heaps using arrays
Skill Level Intermediate
1. Introduction to Algorithms
2. Analysis of Algorithms
3. Basic Sorting and Search Algorithms
4. Linked Lists
5. Stacks and Queues
7. Binary Search Trees
8. More Sorting Algorithms
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.