+ 1
How to use fibbonacci series in c++ ,and how to make with EOS=0
12 Antworten
0
If performance is not super important for you, the <chrono> thing might be overengineering, tho.
0
yes,fibbonacci series
0
I also don't understand,this is the question We define as "value of a sequence of natural values at any value that matches the sum of the two that the minimum there exists", obviously, the first and second unasequencia values can never be values because if a sequence has some Fib value ", it contains three elements. We want to detect the existence of a Fib value in a sequence of naturals.ons dent ENTRY: Sequence of naturals [Eos ol.OUTURE: Returns the position of the value" Fib found, or if no existe.EXEMPLES: Sequence [Naturals Eos = 0]: 9 8 1 1 8 7 9 16 8 9 0 Fib a posicio: 8
0
Ok, so you use a range based for loop to go through the input sequence. You check whether the current element is a fibonacci value using an std::array with all the fibonacci values within the range of your data type. Make the array sorted so that binary_search from <algorithm> can be used. Then test if linear search or binary search is faster using <chrono> (not in the published executable of course). If the current element is a fibonacci number, you print that to the screen.
0
I looked in the internet: If your array size is below 80, it's faster to use linear search. Otherwise you should use binary search. No need for <chrono> checkings anymore. ( :
0
it's very confusing ,I wil try
0
to use array and sequences position of Fibonacci
- 1
Could you tell me what fib and eos is, please?
- 1
So fib means fibonacci. What does eos mean?
- 1
And does use mean implementing it or really finding a use for it?
- 1
What confused you?
- 1
It's to save execution time. You can also calculate for every element. That's slower but more straight-forward.