Join Raghavendra Dixit for an in-depth discussion in this video O(n²) sorting algorithms: Comparison, part of Introduction to Data Structures & Algorithms in Java.
- [Instructor] Let's compare the three sorting algorithms…which we have studied.…All of these take order of N square time in the worst case,…but there are still few other differences between them.…Out of these three,…bubble sort is the most inefficient algorithm.…Practically, it is never used in real programs,…and it just starts so that,…well, (chuckles) we have one more thing to study about.…I'm just kidding, okay?…Actually, it is a very simple algorithm to understand,…so it is studied as a first sorting algorithm.…
Selection sort is a little better algorithm…than bubble sort.…And one interesting thing about selection sort…is that its running time is independent…of the ordering of elements…because we need to perform the same number of steps…to search for the smallest element…and then exchange it with the element at the right slot.…So it requires the same number of steps in the exchange,…as well as the same number of steps…in the selection of minimum,…so it doesn't quite matter if the array…is nearly sorted or not.…
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.