8.5 The following procedure computes the maximum value in a list of numbers: max( [X], X). max(...
Question:
8.5 The following procedure computes the maximum value in a list of numbers: max( [X], X). max( [X | Rest], Max) :- max( Rest, MaxRest), ( MaxRest >= X, !, Max = MaxRest ; Max = X). Transform this into a tail-recursive procedure. Hint: Introduce accumulator argument MaxSoFar.
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
Artificial Intelligence In Power System Optimization
ISBN: 9781578088058
1st Edition
Authors: Weerakorn Ongsakul, Vo Ngoc Dieu
Question Posted: