Pergunta de entrevista da empresa Amazon

Given 'n' integers, print the numbers given in a range

Respostas da entrevista

Sigiloso

30 de mar. de 2012

Use binary search tree to save the n numbers and print all the numbers that fall between the given range.

1

Sigiloso

25 de mai. de 2012

The question doesn't say the numbers are sorted, so it would be cheaper to do a linear search. If the numbers were sorted then do a binary search for either ends of the range and print the numbers in between.