Class FibonacciAlgorithm

java.lang.Object
topics.parallel.fibonacci.FibonacciAlgorithm

public class FibonacciAlgorithm extends Object

Naive Recursive Fibonacci

Calculates the Fibonacci sequence using a purely mathematical, highly inefficient recursive approach. This implementation deliberately ignores optimizations like memoization to demonstrate exponential time complexity. It serves as a baseline to highlight the necessity of parallel computing strategies.

Complexity

  • Time Complexity: O(2^N) - Exponential growth. Every calculation branches into two identical sub-trees, causing massive redundant processing.
  • Space Complexity: O(N) - Linear memory required for the deep recursive stack frames.
Author:
vicegd
  • Constructor Details

    • FibonacciAlgorithm

      public FibonacciAlgorithm(int targetIndex)
      Initializes the algorithm with the target sequence index.
      Parameters:
      targetIndex - The mathematical index (N) to compute.
  • Method Details

    • solve

      public long solve()
      Triggers the recursive calculation.
      Returns:
      The computed Fibonacci sequence value.