- -
UPV
 

Recursion in Python: traversing a list with indices

In this video we learn how to work with lists using recursive algorithms and indices for efficiency. We explore a method that analyzes one element per iteration, using two positional parameters to mark the beginning and end of our analysis. This approach is more efficient than using slices because it modifies an index instead of copying the list every time. The user can call this method easily by providing default parameters from the beginning to the end of the list. We also discuss alternative approaches, including top-down traversal with one or two parameters, which allow us to analyze the full list and reach the base case of an empty list.


EMAS upv