laboratory/experiments/go/array-sum
2022-04-17 23:39:25 +01:00
..
array_sum.go migrate to forge.dananglin.me.uk 2022-04-17 23:39:25 +01:00
array_sum_test.go migrate to forge.dananglin.me.uk 2022-04-17 23:39:25 +01:00
README.md migrate to forge.dananglin.me.uk 2022-04-17 23:39:25 +01:00

Array Sum

This package contains functions to return the sum of all elements of a slice. There are three main functions which all return the same result but uses different methods. These are:

  • SumWithForLoop - Uses a for loop to calculate the sum.
  • SumWithRecursion - Uses recursion to calculate the sum.
  • SumWithTailRecursion - Uses tail recursion to to calculate the sum.