KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have just finished a job interview and I was struggling with this question, which seems to me as a very hard question for giving on a 15 minutes interview. The question was: Write a function, which given a stream of integers (unordered), builds a balanced search tree. Now, you can't wait for the input to end (it's a stream), so you need to balance the tree on the fly. My first answer was to use a Red-Black tree, which of course does the job, but i have to assume they didn't expect me to implement a red black tree in 15 minutes. So, is there any simple solution for this problem i'm not aware of? Thanks, Dave
Tags (comma-separated)
Save Edits
Cancel