Oracle-OCI | ic3 (virtual onsite)| Sort doubly linked list with log(n) time complexity

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2021-12-10Added By Anonymous
Source: Link

Company: Oracle
Role: ic-3
Interview Stage: Onsite
Location: unknown
Year: unknown

Original Post Content:

I was asked to sort a doubly linked list in log(n) time complexity. I was able to provide the brute force O(n^2) and an optimized one in O(NlogN) using merge sort. But was unable to get the log(n) solution. The interviewer was not expecting anything less than log(n) and told me I failed. Does anyone know the solution of the above problem?

He gave a hint to use a TreeNode but I was unable to get to the solution.

Comments