After getting back from Stanford’s iD Tech Programming Academy yesterday I thought I might try improving some of my own projects instead on working on others for a change. I took to my old Merge Sort Visualizer for Android and decided to optimize rendering, threading, improve random seeding, and more. After all of my optimizations, sorting a million integers is no longer an exhaustive task for the renderer. To do this I made the following changes to my code:
- Cut off rendering for any objects off screen (duh!)
- Added boolean flags during generation and sorting to avoid null pointer exceptions
- Thread blocking that will recursively complete actions such as re-seeding or sorting after active operations have finished
- Only added data objects to Merge Sorter class when a merge sort has been executed
To see my full Merge Sort Visualizer for Android check out my projects page.