This project contains two Java implementations of Tetranacci number calculations: a recursive (exponential) version and an iterative (linear) version.
Tetranacci numbers are a generalization of Fibonacci numbers where each term is the sum of the previous four terms. The first few Tetranacci numbers are:
0, 0, 0, 1, 1, 2, 4, 8, 15, 29, 56, 108...
This project implements:
BinaryTetranacci.java
- A recursive solution with exponential time complexity, which is inefficient for largen
.LinearTetranacci.java
- An iterative solution with linear time complexity, optimized for larger values ofn
.
- BinaryTetranacci.java - Contains the recursive implementation.
- LinearTetranacci.java - Contains the iterative implementation.
- README.md - This file, providing an overview of the project.
- Compile the Java files:
javac BinaryTetranacci.java javac LinearTetranacci.java