fibonacci Algorithm

If the components being searched have non-uniform access memory storage (i. e., the time needed to access a storage location vary depending on the location accessed), the Fibonacci search may have the advantage over binary search in slightly reduce the average time needed to access a storage location. 

On average, this leads to about 4 % more comparisons to be executed, but it has the advantage that one only needs addition and subtraction to calculate the index of the accessed array components, while classical binary search needs bit-shift, division or multiplication, operations that were less common at the time Fibonacci search was first published.
package main
import "fmt"

//using recursion
func fibo(num int) int {
  if num <= 1 {
    return num
  }
  return fibo(num -1) + fibo(num - 2)
}

func main(){
  num := 10
  result := fibo(num)
  fmt.Println(result)
}

LANGUAGE:

DARK MODE: