Join Raghavendra Dixit for an in-depth discussion in this video Quicksort: The partition step, part of Introduction to Data Structures & Algorithms in Java.
- [Instructor] Let's get to writing…the pseudo-code for the partition step.…So, we have this routine, which will partition the edit A…from start to end.…So, as said earlier, let's use the pivot element…as the last element of the edit.…Then we initialize a variable I to the start value.…So, I will be used as an index.…Which, at the beginning, is here.…Then we create another index variable J,…which goes from I to end minus one, like this.…
All right?…So, this starts from I and inside this loop…we compare, if element AJ is less than…or equal to the pivot element.…And if it is, we exchange the elements set I and J and ISS.…Okay?…And then implement I.…So right now, the value at J…is not less than the pivot element.…Hence, we just move J.…Because J is varying in the full loop.…
And now, AJ, which is nine,…is less than the pivot element, 10.…Hence, we exchange AI and AJ and then implement I.…Then, J moves ahead in the full loop.…And again, AJ is less than the pivot,…so AI and AJ exchange places and I is implemented by one.…
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?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
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.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.