Cover image for Oracle
Logo

Oracle

Engaged employer

Oracle

Add an Interview

Interview Question

Software Developer Interview

-

Oracle

Technical interview was done on phone+a tool to share screen for code. The question was to find kth smallest element in a BST. Also was asked to improve the complexity. Interview was 30 min long.

Interview Answer

1 Answer

0

I wrote inorder traversal code using recursion. So for inorder traversal of a BST the nth smallest element would be the nth element in the inorder traversal. It's complexity was O(n). They asked me to evaluate and try to reduce the comp-lexity to which I thought of only traversing to the time we get to the kth element instead of traversing whole tree.

Anonymous on

Add Answers or Comments

To comment on this, Sign In or Sign Up.