double recursion

Asked 2 years ago, Updated 2 years ago, 84 views

Hi, everyone. In the process of studying double reflexes, I'm asking because I don't understand the following function.

I don't quite understand how the function to get the maximum value works, as follows: How does the function below run without the l,r value itself?

Thank you for your answer

recursion python function

2022-09-22 18:48

1 Answers

print("max=", findMax(list,0,len(list)-1)))

I've already passed the l and r while writing findMax(list, blah, blah blah).

findMax() If you look at the contents of the function itself,

# Strategy...
        lmax = findMax (list, this or that)
        rmax = findMax (list, what, what)
# Sneak...

You can see that this is how they're passing the price.

If you're curious about what kind of magic findMax() itself uses to find the maximum value, it's better to study what we call split conquest technique.


2022-09-22 18:48

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.