Translate

Visit to www.mrmcse.com

10 March 2018

For the following list of elements trace the recursive algorithm for finding max and min and determine how many comparisons have been made:- 22, 13, -5, -8, 15, 60, 17, 31, 47




22, 13, -5, -8, 15, 60, 17, 31, 47

We keep on dividing the list into sub lists until we have 2 members in each sub lists. Then we find the max and min from the sub list and forward it to the larger sub list consisting of two sub lists. Each sub list is denoted by the following notation:

(i) Si denotes starting index of the sub list
(ii) ei denotes the ending index of the sub list
(iii) max denotes the maximum number of the sub list.
(iv) min denotes the minimum number of the sub list.























No comments:

Post a Comment