Given an array arr of integers, which of the following algorithms does NOT correctly compute the sum of its elements?

1
Using a loop: sum = 0; for element in arr: sum += element
2
Using recursion: sum(arr) = arr[0] + sum(arr[1:])
3
Using a mathematical formula: sum = (n * (n + 1)) / 2
4
Using built-in functions: sum(arr)

Sponsored

hivanix.in

Visit

This quiz is brought to you by hivanix.in

🌐 Web App Development

Quick Navigation