CSSE 2 Data Structures and Algorithms III

Worksheet 1: Array Processing and Searching Algorithms

Date: 1/10/2001

 

1. Given an integer array f[N], N >= 0, compute the largest element together with the frequency of its occurrence.

2. Given an integer array f[N], N >= 0, determine the position of x in the array

3. Given 2 mathematical functions H.X and G.X determine the smallest natural x such that H.X and G.X intersect.

4. Given an integer M find the smallest X such that M<= pow(2,x). {Use math.h library}

5. Given an integer array f[N], N >= 0, determine if the array is a palindrome

6. Given an integer array f[N], N >= 0, find the length of a sequence of numbers beginning at f[i] where the sequence is terminated by the integer 0.

7. Given an integer array f[N], N >= 0, determine if the elements are unique.

8. Given a sorted integer array f[N], N >= 0, determine if the elements are unique.

9. Given a sorted integer array f[N], N >= 0, and some x determine if x is an element of the array using the strategy known as binary search.

10. Calculate the complexity of the above algorithms.