دو سوال جا افتاده از نمونه سوالات قبلی
Next two questions are on PRAM. (Linearly ordered means any two elements are comparable and they can be oredered from smaller to bigger)
Problem 6: Let A=(a_1,a_2,...,a_n) be an array of elements drawn from a linearly ordered set. The suffix-minima problem is to compute for each i, where 1 <= i <= n, the minimum element among {a_i,a_{i+1},...,a_n}. Develop an O(log n) time algorithm to compute suffix minima of A using a total of O(n) operations.
Problem 7: Given an array A=(a_1,a_2,...,a_n) where the elements come from a linearly ordered set S, and given two elements x,y in S, show how to store all the elements a_i from A that are between x and y in consecutive memory locations.
Your algorithm should run in O(log n) time using O(n) operations.