A SwiftUI-based iOS application built with Cursor that provides an interactive and educational visualization of various sorting algorithms with real-time animation and audio feedback.
-
Multiple Sorting Algorithms: Visualize 12 different sorting algorithms:
- Bubble Sort (O(n²))
- Quick Sort (O(n log n))
- Merge Sort (O(n log n))
- Insertion Sort (O(n²))
- Heap Sort (O(n log n))
- Radix Sort (O(nk))
- Time Sort (hybrid algorithm, O(n log n))
- Bucket Sort (O(n+k))
- Selection Sort (O(n²))
- Shell Sort (O(n (log n)²))
- Cube Sort (O(n log n))
- Bogo Sort (O(n!))
-
Interactive Controls:
- Adjust array size (10-100 elements) with a slider
- Control animation speed (1x-20x) for faster or slower visualization
- Toggle audio feedback on/off
- Choose between uniform and non-uniform data distribution
- Start, stop, and randomize arrays at any time
-
Real-time Visualization:
- Color-coded bars show the sorting process in action
- See comparisons, swaps, and sorted elements with distinct visual feedback
- Watch how each algorithm approaches the sorting problem differently
-
Audio Feedback:
- Hear tones that correspond to the values being compared and sorted
- Audio pitch changes based on bar height for intuitive feedback
- Celebratory sound effect when sorting is complete
-
Modern UI/UX:
- Clean, responsive interface optimized for landscape orientation
- Dynamic Island support on newer iPhones
- Proper handling of safe areas across all iOS devices
- Informative algorithm descriptions for each sorting method
- Completion animation that highlights the sorted array
-
Educational Value:
- Compare algorithm efficiency in real-time
- Understand how each algorithm approaches the sorting problem
- Visualize algorithm complexity with different array sizes
- iOS 17.6+
- Xcode 14.0+
- Swift 5.0+
- Clone the repository
- Open
SortingVisualizerApp.xcodeprojin Xcode - Build and run the app on your device or simulator (landscape orientation)
- Launch the app in landscape orientation
- Choose a sorting algorithm from the dropdown menu
- Use the "Array Size" slider to adjust the number of elements
- Use the "Animation Speed" slider to control the visualization speed
- Toggle audio feedback and distribution type as desired
- Press "Randomize Array" to generate a new random array
- Press "Start Sorting" to begin the visualization
- Press "Stop Sorting" at any time to interrupt the sorting process
This project is licensed under the MIT License
- Created as part of a SwiftUI learning project
- Inspired by various sorting visualization tools
- Designed to make learning about sorting algorithms engaging and interactive