Skip to content

Commit 5d8be6f

Browse files
committed
Update documentation
1 parent 7855232 commit 5d8be6f

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

math/fibonacci.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
/**
22
* @file
3-
* @brief Naive recursive algorithm to calculate the n-th [Fibonacci
3+
* @brief n-th [Fibonacci
44
* number](https://en.wikipedia.org/wiki/Fibonacci_sequence).
55
*
66
* @details
7-
* Calculate the the value on Fibonacci's sequence given an
8-
* integer as input.
7+
* Naive recursive implementation to calculate the n-th Fibonacci number.
98
* \f[\text{fib}(n) = \text{fib}(n-1) + \text{fib}(n-2)\f]
109
*
1110
* @see fibonacci_large.cpp, fibonacci_fast.cpp, string_fibonacci.cpp
@@ -26,16 +25,16 @@ namespace fibonacci {
2625
/**
2726
* @brief Function to compute the n-th Fibonacci number
2827
* @param n the index of the Fibonacci number
29-
* @returns n-th element of the Fbinacci's sequence
28+
* @returns n-th element of the Fibonacci's sequence
3029
*/
3130
uint64_t fibonacci(uint64_t n) {
32-
// If the input is 0 or 1 just return the same
31+
// If the input is 0 or 1 just return the same (Base Case)
3332
// This will set the first 2 values of the sequence
3433
if (n <= 1) {
3534
return n;
3635
}
3736

38-
// Add the last 2 values of the sequence to get next
37+
// Add the preceding 2 values of the sequence to get next
3938
return fibonacci(n - 1) + fibonacci(n - 2);
4039
}
4140
} // namespace fibonacci

0 commit comments

Comments
 (0)