Enrol to start learning
Reading is open to everyone. Enrolling is free, and it is what unlocks the audio lessons, practice tests and progress tracking.
15.4. Predecessor Function
This section
Practice test
11 questions on this section. Wrong answers show you what to read again.
Sign up to take itWhole chapter
Revision test
Mixed questions from across the chapter. Your answers get marked.
Sign up to take itQuick
Flashcard drill
4 cards from this lesson. Good the night before a test.
Try these first
- 1.
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.
- 2.
What is the maximum value in a BST with root 10 and right children 12, 14, 16?
Hint
Find the right-most node.
- 3.
What value does the method to find a minimum return?
- The maximum value
- The left-most node
- The right-most node
Hint
Think about how we traverse left.
- 4.
True or False: The predecessor of a node with children both left and right is always the maximum of the left subtree.
- True
- False
Hint
Which subtree gives a maximum value?
- 5.
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.
- 6.
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?
Exercises
Total Questions
2
Estimated Time
4 min
Passing Score
70%
Instructions
- Read each question carefully
- You can use hints if you need help
- Complete all questions before submitting
4 more questions available
Enrol freeQuiz
Total Questions
2
Estimated Time
4 min
Passing Score
70%
Instructions
- Read each question carefully
- You can use hints if you need help
- Complete all questions before submitting
1 more question available
Enrol freeChallenge Problems
Total Questions
2
Estimated Time
4 min
Passing Score
70%
Instructions
- Read each question carefully
- You can use hints if you need help
- Complete all questions before submitting