You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An open source app focused on show in a visual way how sorting algorithms actually works.
Available on the app store
Do you want to contribute? Check the backlog
// TODO:
New algorithms;
Control animation speed;
Add algorithm details about the selected algorithm;
Improve code coverage (unit tests);
More features to the backlog :)
Adding a new algorithm
Create a class implemeting the protocol Algorithm. Following the example for the class InsertionSort, you'd need to set the title of your algorithm, the image (pick a nice logo representing your algorithm:)) and description. In the method GenerateSwaps, add the necessary logic to generate all cell swaps which would be necessary.
finalclassInsertionSort:Algorithm{finalvartitle:String="Insertion Sort"finalvarimage:String="ic_insertion"finalvardescription:String="Insertion Sort Description"finalfunc generateSwaps(from list:[Int])->[(x0:Int, x1:Int)]{if list.count ==1{return[]}vararray= list
varswaps=[(x0: Int, x1: Int)]()
// APPEND ALL GENERATED SWAPS TO IT'S ARRAY
return swaps
}}
Try adding your own solution, feel free to suggest changes on the current code. If you're ready to submit a contribution, create a pull request describing your approach. All contributions are welcome even the small ones.