daais.blogg.se

Fibonacci in openmp
Fibonacci in openmp





Essentially, we find the (n-2)th Fibonacci number. In the above example, 144 is the 12th Fibonacci number.Īfter this, we move back twice in the Fibonacci series from that number. Let us say that this is the nth Fibonacci number. That means if the size of the list is 100, then the smallest Fibonacci number greater than 100 is 144. Then we find the smallest Fibonacci number greater than or equal to the size of the list. Now let’s dive into the details.įirst, we need to have the length of the given list. Also, instead of performing division to do that, it performs addition which is less taxing on the CPU. In the Fibonacci search, we use the Fibonacci numbers to divide the list into two parts, so it will divide the list into two parts of different lengths.







Fibonacci in openmp