Firstly, What is Dynamic Set S? -> A set (abstract data type) that supports insertion and/or deletion of elements.
Direct-address table T of length m.
Now, we need to find maximum element from all the elements present in S. As we know that we are given direct-address table so, we need to use direct addressing. In direct-address table method there will be a universe(U) of keys from which only 'K' number of keys will be pointing to an object present in S and rest will return NIL.
For finding the maximum element if there are 'm' total elements then the procedure will be like.
T is a direct-address table or array which supports all dictionary operations(Insert, Delete and Search).
int FIND_MAX(T, m){
int max = -1;
for(int i = 0; i < m; i++){
if(T[i] != NIL && max < T[i]){
max = T[i];
}
}
return max;
}
This will return maximum element. Now, if T will have all slots occupied then finding maximum in worst case take O(m).