Tag: Recursion

Merge sort in Python

Problem Implement merge sort algorithm in Python. Solution For definition and explanation, You may refer to the following post. This post is just a rewrite in Python. Before jumping directly to the code, check out the following nice YouTube clip Recursive merge sort in python Take a look at the comments for explanation... # Merge

Python recursive sum function

Recursive function to find array sum using python Write a recursive function to find the sum of all elements in an Array. Recursive definition of sum If the array is only one element then return that element otherwise return the first element added to all elements that come after. Recursive sum algorithm The following is

Python for loop

Introduction Any computer algorithm requires two control flow structures: iteration and selection. Our topic today is mainly about iteration using the Python for loop. The goal of this post is to achieve three objectives: Provide a beginner introduction to the for loop control structure Include example code snippets for copy and paste lovers Cover some