?5E a) Adapt Algorithm I in Section 3.1 to find the maximum and the minimum of a sequence of ?n elements by employing a temporary maximum and a temporary minimum that is updated as each successive clement is examined. b) Describe the algorithm from part (a) in pseudocode. c) How many comparisons of elements in the sequence are carried out by this algorithm? (Do not count comparisons used to determine whether the end of the sequence has been reached.)

Solution: Step 1: The objective of this question is to find the maximum element and the minimum of a sequence of n elements by employing a temporary maximum and a temporary minimum that is updated as each successive element is examined. Step 2: For finding the max value, We need to introduce a placeholder called max with the first component in the succession. At that point contrast the every last component and each other. On the off chance that any component is more noteworthy than max esteem simply supplant it with the specific component. This is a pseudocode. Step 3: Algorithm for finding the maximum element: