Created the race simulation where users can input an array and watch different sorting algorithms (Bubble Sort, Insertion Sort, Merge Sort, Selection Sort) race against each other. Each person represents each algorithm's performance on a canvas, displaying sorting speeds and the final results, fetched from the backend.
Created an Olympic-style race simulation where users can input a Fibonacci number to see different programming methods (For Loop, Recursion, While Loop, Dynamic Programming) compete in a race. Each runner on the canvas represents a different method's performance, showcasing execution speeds and results, all of which are fetched from backend.
Calculation for Fibonacci
Fibonacci Dynamic
Explanation:
In this code, I have implemented a dynamic method for calculating Fibonacci numbers. When the fibo function is called with an integer n, it first checks if n is 1 or less. If n is greater than 1, the function initializes an array fib with a length of n + 1, where each index of the array represents a Fibonacci sequence number. The function then iteratively fills this array, starting with fib[0] = 0 and fib[1] = 1. From the third element onwards (index 2 to n), each element fib[i] is assigned the sum of the two preceding elements (fib[i - 1] + fib[i - 2]).
Fibonnaci For loop
Explanation:
In this code, I created a for loop to find Fibonacci numbers. It starts by checking if the given number n is 1 or less. If it is, the code just returns n because the first two numbers in the Fibonacci series are 0 and 1. But if n is more than 1, I set up two long variables, fib and prevFib, both starting at 1. These keep track of the latest numbers in the Fibonacci sequence. Then, in a for loop that goes from 2 to n, the code keeps updating fib to be the sum of itself and prevFib, and prevFib becomes the old fib.
Fibonnaci Recursive
Explanation: In this code, I used a recursive method to find Fibonacci numbers. The code works by checking if the number n is 1 or less. If it is, it just returns n, because the first two Fibonacci numbers are 0 and 1. But if n is more than 1, the function calls itself twice – once with n-1 and once with n-2. These calls keep breaking down the problem into smaller pieces until they reach the base case of 0 or 1. Then, it adds up these results to get the Fibonacci number for position n.
Fibonnaci While loop
Explanation:
In this code, I've used a while loop to calculate Fibonacci numbers. It starts by checking if the number n is 1 or less. If yes, the code returns n directly because the first two numbers in the Fibonacci sequence are 0 and 1. For n greater than 1, I set up three long variables: a, b, and c, with a starting at 0 and b at 1. These variables help in calculating the next number in the sequence. The while loop runs as long as i, which starts at 2, is less than or equal to n. Inside the loop, c is assigned the sum of a and b, and then a and b are updated to the next two numbers in the sequence. When the loop ends, b holds the Fibonacci number at position n.
Sorting
Bubble Sort
Explanation: I wrote code that goes through the array multiple times, each time comparing adjacent elements and swapping them if they are in the wrong order. This process repeats until the array is sorted. It's a simple method where each pass pushes the largest element to the end, like bubbles rising to the surface.
Insertion Sort
Explanation: The code starts from the second element and compare it with the elements before it, moving each one up to make space for the new element if it's greater. This is repeated for each element, inserting it into its correct position, like sorting a hand of cards.
Explanation: I implemented a divide-and-conquer strategy. The array is recursively split into two halves until each subset has a single element, then these subsets are merged in a sorted manner. This method efficiently combines the elements back into a sorted array.
Selection Sort
Explanation: The code repeatedly finds the minimum element and move it to the start of the array. This is done by selecting the smallest unsorted element and swapping it with the element at the beginning of the unsorted section, gradually moving the boundary between sorted and unsorted parts of the array.
Explanation: Contains the endpoints from the result of the calculations of the fibonacci and the nanoseconds are calculated with system.nanoTime from start to end through each fibonacci type of solving.
Explanation: Contains the endpoints from the result of the different methods of sorting and the nanoseconds are calculated with system.nanoTime from start to end through each type of sorting.
Key Commits (Committed everything at the end, with fully functional code and throughout development during 3 weeks, was testing through local host) :
fibonacci calculations for each method finished and controller finished
Sorting finished as finished all the sorting methods and the sorting controller
For frontend, swimming finished with fetched endpoints
Frontend, Track event finished, with fetched endpoints
Some Improvements:
Am working on scaling the speed algorithm of the cubes on the swimming and the track players on the track, any one of methods is relatively slower than other three methods, also happened in another group. It also maybe that the one that is slower is slower relative to the other three by a large amount of nanoseconds. This may just be that one algorithm is a lot slower than other three most of the times.
Track Event
https://github.com/Code-Demons/miniproject/assets/111464993/ec4d05af-00ae-4add-a992-15fbd07d04d3
Created the race simulation where users can input an array and watch different sorting algorithms (Bubble Sort, Insertion Sort, Merge Sort, Selection Sort) race against each other. Each person represents each algorithm's performance on a canvas, displaying sorting speeds and the final results, fetched from the backend.
Swimming Event
https://github.com/Code-Demons/miniproject/assets/111464993/5835a7ef-4bfb-4164-9fbd-1fe7cfdacf09
Created an Olympic-style race simulation where users can input a Fibonacci number to see different programming methods (For Loop, Recursion, While Loop, Dynamic Programming) compete in a race. Each runner on the canvas represents a different method's performance, showcasing execution speeds and results, all of which are fetched from backend.
Calculation for Fibonacci
Fibonacci Dynamic
Explanation: In this code, I have implemented a dynamic method for calculating Fibonacci numbers. When the fibo function is called with an integer n, it first checks if n is 1 or less. If n is greater than 1, the function initializes an array fib with a length of n + 1, where each index of the array represents a Fibonacci sequence number. The function then iteratively fills this array, starting with fib[0] = 0 and fib[1] = 1. From the third element onwards (index 2 to n), each element fib[i] is assigned the sum of the two preceding elements (fib[i - 1] + fib[i - 2]).
Fibonnaci For loop
Explanation: In this code, I created a for loop to find Fibonacci numbers. It starts by checking if the given number n is 1 or less. If it is, the code just returns n because the first two numbers in the Fibonacci series are 0 and 1. But if n is more than 1, I set up two long variables, fib and prevFib, both starting at 1. These keep track of the latest numbers in the Fibonacci sequence. Then, in a for loop that goes from 2 to n, the code keeps updating fib to be the sum of itself and prevFib, and prevFib becomes the old fib.
Fibonnaci Recursive
Explanation: In this code, I used a recursive method to find Fibonacci numbers. The code works by checking if the number n is 1 or less. If it is, it just returns n, because the first two Fibonacci numbers are 0 and 1. But if n is more than 1, the function calls itself twice – once with n-1 and once with n-2. These calls keep breaking down the problem into smaller pieces until they reach the base case of 0 or 1. Then, it adds up these results to get the Fibonacci number for position n.
Fibonnaci While loop
Explanation: In this code, I've used a while loop to calculate Fibonacci numbers. It starts by checking if the number n is 1 or less. If yes, the code returns n directly because the first two numbers in the Fibonacci sequence are 0 and 1. For n greater than 1, I set up three long variables: a, b, and c, with a starting at 0 and b at 1. These variables help in calculating the next number in the sequence. The while loop runs as long as i, which starts at 2, is less than or equal to n. Inside the loop, c is assigned the sum of a and b, and then a and b are updated to the next two numbers in the sequence. When the loop ends, b holds the Fibonacci number at position n.
Sorting
Bubble Sort
Explanation: I wrote code that goes through the array multiple times, each time comparing adjacent elements and swapping them if they are in the wrong order. This process repeats until the array is sorted. It's a simple method where each pass pushes the largest element to the end, like bubbles rising to the surface.
Insertion Sort
Explanation: The code starts from the second element and compare it with the elements before it, moving each one up to make space for the new element if it's greater. This is repeated for each element, inserting it into its correct position, like sorting a hand of cards.
MergeSort
https://github.com/Code-Demons/miniproject/assets/111464993/9665d914-1c06-41e4-a7b6-26d4ba4da6d1
Explanation: I implemented a divide-and-conquer strategy. The array is recursively split into two halves until each subset has a single element, then these subsets are merged in a sorted manner. This method efficiently combines the elements back into a sorted array.
Selection Sort
Explanation: The code repeatedly finds the minimum element and move it to the start of the array. This is done by selecting the smallest unsorted element and swapping it with the element at the beginning of the unsorted section, gradually moving the boundary between sorted and unsorted parts of the array.
Controllers
Fibonacci Controller
https://github.com/Code-Demons/miniproject/assets/111464993/803da155-d3c8-4de1-8e3c-fa10afa2dfa4
Explanation: Contains the endpoints from the result of the calculations of the fibonacci and the nanoseconds are calculated with system.nanoTime from start to end through each fibonacci type of solving.
Sorting Controller
https://github.com/Code-Demons/miniproject/assets/111464993/fe24acd8-7481-44b6-8e33-bc6b232820ff
Explanation: Contains the endpoints from the result of the different methods of sorting and the nanoseconds are calculated with system.nanoTime from start to end through each type of sorting.
Key Commits (Committed everything at the end, with fully functional code and throughout development during 3 weeks, was testing through local host) :
Some Improvements: