Join Raghavendra Dixit for an in-depth discussion in this video Time complexity of operations on binary search trees, part of Introduction to Data Structures & Algorithms in Java.
- [Narrator] Now we come to the last part of this chapter,…where we look at the time complexity of insert,…delete and search operations on binary search trees…and of course, when we analyze these operations…we assume that the binary search tree is perfectly balanced,…alright.…So let's start with searching for an item.…Now, when we look for an item or some data,…what do you think will happen in the worst-case?…Well we always start from the root, right?…And then based on whether the data to be found…is greater than or less than the data at a node,…we pick one of the children and check there…until a node does not have any children, right.…
And that happens in the last layer of the tree…where we have all the leaves,…assuming we have a perfectly balanced tree.…And the data could be present in one of those leaf nodes.…So in each layer we do a comparison and then move on…to the next layer.…So in the worst case, we will be doing memory access…proportional to the height of the tree, right?…So we say that the worst-case time complexity…
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.