Data Structured66_f1_map_k_range

Map Key in Range

5fef643a-bf67-411a-b2df-b3ac53a3ebf1.cppC++
1// Loading code...

Selected Submission

100 / 100
0.244s
10860 KB
Tree
Time Comp.
O(log n + k), where n is the number of nodes in the tree and k is the number of nodes within the range [a, b].
Space Comp.
O(h + k), where h is the height of the tree and k is the number of nodes within the range [a, b] (due to the recursion stack and the result vector).
Readability
7/10

"The code implements a binary search tree (BST) based map and provides a function to retrieve values within a given key range. The core data structure is a tree, and the algorithm utilizes recursion to traverse the tree efficiently."

History

AttemptPoints Time
Try #310011/16/2024
Try #22011/16/2024
Try #1011/16/2024