Recursion

Recursion

Introduction

This is my own algorithms that use Recursion to learn more about Recursion.

Version:

  • It is written by using IntelliJ IDEA Community Edition 2019.1.3 x64
  • JDK version 11

How to install:

If you use IntelliJ IDEA use new -> Project From Version Control -> Git and paste https://github.com/JimmyYouhei/Recursion.git

How to use:

  • Using the Main class to run any custom command (I have included some example command)
  • Recursion interface is fully written with method:
    • factorialHeadRecursion(int number): calculate the factorial of the number given and using head Recursion
    • factorialTailRecursion(int number): like above but using tail Recursion
    • printLinkedList(LinkedList linkedList): print out all elements of an int Linked List
    • printLinkedListReverse(LinkedList linkedList): like above but in reverse order
    • greatestCommonDivisor(int number1 , int number2): Euclid greatest common divisor algorithm for 2 number given
    • decimalToBinary(int decimal): convert the decimal number to a binary string
    • powerMethod(int base , int times): return the result of base^times
    • printFibonacciSequence (int numberOfElement): print the Fibonacci Sequence that has total element fit the number given (exclude the “0”)

Note:

  • Due to the class is written purely for learning purpose so very little Exception handle is expected
  • The project could use some JUnit tests, but I was too lazy to write them due to Recursion took a lot of my brain power already so will update later
  • Except for the Fibonacci Sequence , all was written originally by me . However, Recursion is hard and I could not claim I have taken a good understanding of it. However I must move on due to the time constraint
  • The project originally plans to include the Tower of Hanoi puzzle. However, I could not have a good understanding of it so will try to include it later
  • The picture of this post is taken by raincrystal

License

MIT License

Leave a Reply

Your email address will not be published. Required fields are marked *