laboratory/experiments/array-sum
2020-03-20 22:35:25 +00:00
..
.gitlab-ci.yml add array-sum experimentation 2020-03-20 22:35:25 +00:00
array_sum.go add array-sum experimentation 2020-03-20 22:35:25 +00:00
array_sum_test.go add array-sum experimentation 2020-03-20 22:35:25 +00:00
README.md add array-sum experimentation 2020-03-20 22:35:25 +00: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.