Unformatted text preview: between ` and u (both inclusive). That is, ﬁnd the number of x in the array A such that ` ≤ x ≤ u . What is the time complexity of your algorithm. 5. Suppose we are given an array of n integers between 1 to m (both inclusive). Preprocess the array such that one can answer the following query in constant time: How many numbers are there in the array which are between ` and u (both inclusive), where 1 ≤ ` ≤ u ≤ m . What is the time complexity of your preprocessing algorithm? Try to make it linear in m and n . 1...
View
Full Document
 Fall '10
 sanjay
 Algorithms, Sort, Array, Englishlanguage films, Computational complexity theory

Click to edit the document details