1. How do you create a React component that interacts with the window object?
2. Given a list and a series of queries, how would you efficiently sort the list after each query?
3. Given a sorted array of integers, find the leftmost and rightmost index of a target value using Binary Search.
4. Amazon can perform searches in O(n) time complexity. Why would it choose to use O(nk) instead, especially considering that 'n' can be large for data structures like hash tables? Is O(nk) actually better than O(n) in this context?
5. What is a virtual function?