Exam 2 CSE 310 2025 Questions and
Answers
Binary Search Tree properties - ANSWER-Each node has 0 to 2 children
Children on left are less than parent
Children on right are greater than parent
Dynamic Set Operations - ANSWER-Add, Delete, Minimum, Maximum, Search,
Predecessor, Successor
Binary Search Tree minimum - ANSWER-Returns the bottom left most node
Binary Search Tree Maximum - ANSWER-Returns the bottom right most node
In order traversal - ANSWER-left, root, right
Pre order traversal - ANSWER-root, left, right
Post order traversal - ANSWER-left, right, root
Tree predecessor - ANSWER-returns the greatest number less than x
Tree successor - ANSWER-returns the lowest number greater than x
Which traversal helps with predecessor/successor - ANSWER-In Order traversal
COPYRIGHT ©️ 2025 ALL RIGHTS RESERVED...TRUSTED & VERIFIED 1
, Binary search tree search runtime - ANSWER-O(h)
Binary search tree insert runtime - ANSWER-O(logn)
Binary search tree transplant runtime - ANSWER-O(1)
Properties of RB BST - ANSWER-Every node is either red or black
Every null node is black
Every red node has black children
Every path has the same number of black nodes
The root is black
T/F: RB Trees can have a path that is twice as long as another - ANSWER-False
Red Black Tree insert run time - ANSWER-O(logn)
Runtime of left rotate and right rotate - ANSWER-O(1)
Two ingredients for dynamic programming - ANSWER-Optimal substructure and
Overlapping subproblems
Difference between dynamic programming and divide and conquer - ANSWER-
Overlapping vs not overlapping subproblems
Longest common subsequence runtime with dynamic programming - ANSWER-
O(mn) where m is the length of subsequence X and n is the length of subsequence
Y
COPYRIGHT ©️ 2025 ALL RIGHTS RESERVED...TRUSTED & VERIFIED 2
Answers
Binary Search Tree properties - ANSWER-Each node has 0 to 2 children
Children on left are less than parent
Children on right are greater than parent
Dynamic Set Operations - ANSWER-Add, Delete, Minimum, Maximum, Search,
Predecessor, Successor
Binary Search Tree minimum - ANSWER-Returns the bottom left most node
Binary Search Tree Maximum - ANSWER-Returns the bottom right most node
In order traversal - ANSWER-left, root, right
Pre order traversal - ANSWER-root, left, right
Post order traversal - ANSWER-left, right, root
Tree predecessor - ANSWER-returns the greatest number less than x
Tree successor - ANSWER-returns the lowest number greater than x
Which traversal helps with predecessor/successor - ANSWER-In Order traversal
COPYRIGHT ©️ 2025 ALL RIGHTS RESERVED...TRUSTED & VERIFIED 1
, Binary search tree search runtime - ANSWER-O(h)
Binary search tree insert runtime - ANSWER-O(logn)
Binary search tree transplant runtime - ANSWER-O(1)
Properties of RB BST - ANSWER-Every node is either red or black
Every null node is black
Every red node has black children
Every path has the same number of black nodes
The root is black
T/F: RB Trees can have a path that is twice as long as another - ANSWER-False
Red Black Tree insert run time - ANSWER-O(logn)
Runtime of left rotate and right rotate - ANSWER-O(1)
Two ingredients for dynamic programming - ANSWER-Optimal substructure and
Overlapping subproblems
Difference between dynamic programming and divide and conquer - ANSWER-
Overlapping vs not overlapping subproblems
Longest common subsequence runtime with dynamic programming - ANSWER-
O(mn) where m is the length of subsequence X and n is the length of subsequence
Y
COPYRIGHT ©️ 2025 ALL RIGHTS RESERVED...TRUSTED & VERIFIED 2