Tuesday, January 4, 2011

next in an array

Design a data structure to find the next higher element for each element in an array.

1 comment:

  1. Precomputing all the solutions is O(n) words and O(1) access time. Scanning the array is O(1) space and O(n) access time. Do you want a tradeoff?

    ReplyDelete