This repository contains solutions to the exercises for the “Recursion” project from The Odin Project (JavaScript course).
fib.js— iterative implementation of generating the first n numbers of the Fibonacci sequence.fibrs.js— recursive implementation to generate the first n Fibonacci numbers.mergesort.js— recursive implementation of the Merge Sort algorithm that sorts arrays.
- Recursion is a programming technique where a function calls itself in order to solve a problem by breaking it into smaller sub-problems.
- In this project you practice recursion in two contexts:
- Generating a Fibonacci sequence (learning base case & recursive step)
- Sorting an array using Divide & Conquer via merge sort — splitting the array into smaller parts, sorting them recursively, then merging back.
- Make sure you have Node.js installed.
- From the command line, run your scripts. For example:
node fibs.js # runs the iterative Fibonacci generator node fibsRec.js # runs the recursive Fibonacci function node mergeSort.js # runs your merge sort implementation