About 1,270,000 results
Open links in new tab
  1. Sum of array elements using recursion - GeeksforGeeks

    Mar 17, 2025 · Given A = [1, 2, 3, 4, 5], the problem is solved recursively by breaking it down step by step. Each step reduces the array size, summing the last element with the sum of the …

  2. Recursive sum of an array in C - Stack Overflow

    Mar 27, 2017 · int arr_sum( int arr[], int n, int sum ) { // must be recursive if (n < 0) { return sum; } sum += arr[n]; return arr_sum(arr, --n, sum); } Alternatively, you change it to not require …

  3. C++ Recursion: Sum of array elements using recursion

    Apr 14, 2025 · Learn how to write a C++ program that uses recursion to find the sum of all elements in an array.

  4. Sum of Array Elements Using Recursion - thejat.in

    To calculate the sum of elements in an array using recursion, we can follow these steps: Base Case: If n (the size of the array) is less than or equal to 0, return 0. Recursive Step: …

  5. C Program to Find the Sum of All Nodes in a Binary Tree

    There are two ways we can find the sum of all the nodes in a given Binary Tree. We can store the elements of tree in an array by using any of the traversal techniques and then find the sum of …

  6. A recursive function that finds the sum of an array in c

    Jun 6, 2013 · sum=rec_sum(0,N-1); The function is shown below, int rec_sum(int array[],start,end) { if(start==end) { return array[start]; } else { return rec_sum(array,start,(start+end)/2) + …

  7. Program to Find Sum of All Array Elements Using Recursion

    Dec 30, 2024 · Write a program to Find Sum of All Array Elements Using Recursion in C#; Explanation: Recursion can be used to discover the total of all the elements in an array by …

  8. Sum of all nodes in a binary tree - GeeksforGeeks

    Oct 2, 2023 · Give an algorithm for finding the sum of all elements in a binary tree. In the above binary tree sum = 106. The idea is to recursively, call left subtree sum, right subtree sum and …

  9. C Program to Find Sum of Array Elements using Recursion

    C program to find sum of array elements using recursion. Below program, contains a user defined function getSum(int *inputArray, int lastIndex), which takes a pointer to an integer array and …

  10. Sum of elements in an array using recursion in C++

    Learn how to find the sum of elements of an array using recursion in C++. We use recursive functions to find the sum of elements in an array.

  11. Some results have been removed
Refresh