- find successors and predecessors using BST (both list will be sorted); in the end, we can easily get top k from the two sorted list - with BST: **inorder traversal gives us sorted predecessors - ...
MY YOUTUBE VIDEO ON THIS Qn : O(n^2) - https://www.youtube.com/watch?v=P74WiyWY3Pk O(n) - https://www.youtube.com/watch?v=4w-_rtiau_Q ...