15.4 - Predecessor Function
Enroll to start learning
You’ve not yet enrolled in this course. Please enroll for free to listen to audio lessons, classroom podcasts and take practice test.
Practice Questions
Test your understanding with targeted questions
What is the minimum value in a BST with root value 8 and left children 7, 6, 5?
💡 Hint: Traverse to the left-most node.
What is the maximum value in a BST with root 10 and right children 12, 14, 16?
💡 Hint: Find the right-most node.
4 more questions available
Interactive Quizzes
Quick quizzes to reinforce your learning
What value does the method to find a minimum return?
💡 Hint: Think about how we traverse left.
True or False: The predecessor of a node with children both left and right is always the maximum of the left subtree.
💡 Hint: Which subtree gives a maximum value?
1 more question available
Challenge Problems
Push your limits with advanced challenges
Given a BST containing numbers 3, 5, 2, 8, find the predecessor and successor for node 3.
💡 Hint: Calculate both branches and pick the respective nodes.
Explain what happens when trying to find the successor of the maximum node in a BST.
💡 Hint: What defines the concept of a maximum node in a BST?
Get performance evaluation
Reference links
Supplementary resources to enhance your learning experience.