Skip to content

mitch3lljones/ruby-recursion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Recursion in Ruby

Odin Project - Recursion

Table of Contents

Fibonacci Sequence

Information

In this program, the first n fibonacci sequence numbers can be found. This was implemented using both recursion (fibs_rec.rb) and iteration (fibs.rb). All the files you will need to run this are in this repository with the instructions in the instructions section. This program is built using Ruby v2.6.3p62.

Status

At this time, the project is finished.

Merge Sort

Information

In this program, a single array is passed and a sorted array is returned. The sort used is a merge sort, with one function to sort the array (using a left and right version of the one passed) and another function to merge the left and right arrays. This is implemented using recursion. All the files you will need to run this are in this repository with the instructions in the instructions section. This program is built using Ruby v2.6.3p62.

Status

At this time, the project is finished.

Instructions

To run these programs, Ruby v2.6.3p62 (or a compatible version) will need to be installed. To check the version of ruby you are using, run this command in terminal:

ruby -v

If ruby is not installed, follow these instructions to install it. After ruby is installed, you should clone this repository to a place easily accessible to you using this command in terminal:

git clone https://github.com/fussykyloren/ruby-recursion.git

Your github username and password should be requested. If not, don't worry about it. After the repository is cloned, you will need to change the directory to where the game example is saved. To to use the fibonacci programs, run this command next:

cd [LOCATION_OF_CLONED_REPOSITORY]/fibonacci

To use the merge sort programs, run this command instead:

cd [LOCATION_OF_CLONED_REPOSITORY]/merge_sort

Once the repository is cloned, you can run the programs. To do this, run this command:

ruby [NAME_OF_PROGRAM].rb

The program names are: fibs.rb, fibs_rec.rb and merge_sort.rb