This repository contains a Java Spring Boot and JavaScript tool for visualizing sorting algorithms.
To create a new algorithm visualization, follow these steps:
-
Create a New Class:
- Navigate to the
src/main/java/com/azelentsov/sortVisualisator/Core/sortAlgorithmsdirectory. - Create a new class file and extend the abstract class
BaseSort.
- Navigate to the
-
Implement Required Methods:
- run(): Implement the main algorithm logic within the
runmethod. During each iteration of the algorithm, callsaveArrayBeforeIteration()before the iteration andsaveArrayAfterIteration()after the iteration. This approach saves and detects swaps of array elements for visualization purposes. Between this functions use thehighlightVariable()method to highlight variables, and thedisplayVariable()method to display variables in the table beneath the sorting graph. - populateProps(): Populate the properties of your algorithm in the
propsHashMap. This HashMap will be used to populate the algorithm comparison row.
- run(): Implement the main algorithm logic within the
-
Annotation:
- After implementing the above steps, don't forget to add the
@Componentannotation to the class.
- After implementing the above steps, don't forget to add the