-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Applications component added to sorting algorithms
- Loading branch information
ruizdiasmatt
committed
Dec 5, 2023
1 parent
8abdd8d
commit bd87acc
Showing
4 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
Frontend/algoverse/src/components/infoContainer/Applications.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
.applicationsContainer { | ||
background-color: #2c98f0; /* Light blue background */ | ||
color: white; /* White text */ | ||
width: 90%; /* Full width */ | ||
height: fit-content; | ||
padding: 20px; /* Some padding around the text */ | ||
box-sizing: border-box; /* Ensure padding doesn't increase the size */ | ||
margin-top: 10px; /* Space above the container */ | ||
margin-bottom: 20px; | ||
white-space: normal; /* Keep nodes in a single line */ | ||
} | ||
|
||
.applicationsContainer h3 { | ||
margin-top: 0; /* Remove top margin of the heading */ | ||
} |
25 changes: 25 additions & 0 deletions
25
Frontend/algoverse/src/components/infoContainer/Applications.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React from "react"; | ||
import "./Applications.css"; | ||
import { useSearchParams } from "react-router-dom"; | ||
import algorithmApplicationsTexts from "./applicationsText.json"; | ||
|
||
function Applications() { | ||
const [searchParams] = useSearchParams(); | ||
const algorithm = searchParams.get("algorithm"); | ||
|
||
let applicationsText = | ||
algorithmApplicationsTexts[algorithm]?.applications || "Default"; | ||
|
||
return ( | ||
<> | ||
<div className="applicationsContainer"> | ||
<h1> Useful Applications </h1> | ||
{applicationsText.map((step, index) => ( | ||
<p key={index}>{step}</p> | ||
))} | ||
</div> | ||
</> | ||
); | ||
} | ||
|
||
export default Applications; |
46 changes: 46 additions & 0 deletions
46
Frontend/algoverse/src/components/infoContainer/applicationsText.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ | ||
"MergeSort": { | ||
"description": "Merge sort is a divide-and-conquer algorithm that works by dividing an array into smaller subarrays, sorting each subarray, and then merging the sorted subarrays back together to form the final sorted array", | ||
"applications": [ | ||
"E-commerce Product Recommendation", | ||
"Medical Imaging", | ||
"Stock Market Analysis", | ||
"E-commerce Search Results", | ||
"Stock Portfolio Management" | ||
] | ||
}, | ||
"SelectionSort": { | ||
"description": "Selection sort is a simple sorting algorithm that works by iterating through an array and selecting the smallest element in the unsorted portion of the array and swapping it with the first element of the unsorted portion.", | ||
"applications": [ | ||
"Embedded Systems", | ||
"Data Storage", | ||
"Computer Graphics" | ||
] | ||
}, | ||
"BubbleSort": { | ||
"description": "Bubble sort is a simple sorting algorithm that repeatedly steps through the list, compares adjacent elements and swaps them if they are in the wrong order.", | ||
"steps": [ | ||
"Error Detection in Computer Graphics", | ||
"Education", | ||
"Data Analysis" | ||
] | ||
}, | ||
"InsertionSort": { | ||
"description": "Insertion sort is a simple sorting algorithm that works by iterating through an array and inserting each element into its proper position in a new sorted array.", | ||
"applications": [ | ||
"Embedded Systems", | ||
"Flash Memory", | ||
"Error Detection in Computer Graphics" | ||
] | ||
}, | ||
"QuickSort": { | ||
"description": "Quick sort is a divide-and-conquer algorithm that works by selecting an element as a pivot, partitioning the other elements into two sub-arrays based on whether they are less than or greater than the pivot, and then recursively sorting the sub-arrays.", | ||
"steps": [ | ||
"Commercial Computing", | ||
"Information Searching", | ||
"Event-driven Simulation" | ||
] | ||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters