-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed code formatting, errors, and compilation warnings. Introduce new array input types, and additional sorting algorithms. Larger array sizes are now properly displayed, among several other changes. #31
Open
Unbreakable-Syntax
wants to merge
289
commits into
bingmann:master
Choose a base branch
from
Unbreakable-Syntax:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
Unbreakable-Syntax
changed the title
Introduce 2 new array input types
Introduce 6 new array input types, and 1 new quadratic sorting algorithm
Oct 4, 2024
Unbreakable-Syntax
changed the title
Introduce 6 new array input types, and 1 new quadratic sorting algorithm
Introduce 6 new array input types, and 2 new quadratic sorting algorithms
Oct 5, 2024
Unbreakable-Syntax
changed the title
Introduce 6 new array input types, and 2 new quadratic sorting algorithms
Introduce 6 new array input types, and 6 additional quadratic sorting algorithms
Oct 5, 2024
Unbreakable-Syntax
changed the title
Introduce 6 new array input types, and 6 additional quadratic sorting algorithms
Introduce 6 new array input types, and 7 additional quadratic sorting algorithms
Oct 5, 2024
Unbreakable-Syntax
changed the title
Introduce 6 new array input types, and 7 additional quadratic sorting algorithms
Introduce 7 new array input types, and 7 additional quadratic sorting algorithms
Oct 5, 2024
Unbreakable-Syntax
changed the title
Introduce 7 new array input types, and 7 additional quadratic sorting algorithms
Introduce 7 new array input types, and 8 additional quadratic sorting algorithms
Oct 7, 2024
Bead Sort, before this fix, makes the last 2 elements after the sorting process is done to be equal, when they shouldn't be, this also results in a small chance of crashing the program. The issue is now resolved.
My declaration of int max is wrong, leading to incorrect results on reverse sorted array, this should FINALLY fix it now, I have also tested it out.
Unbreakable-Syntax
changed the title
Introduce 7 new array input types, and 8 additional quadratic sorting algorithms
Introduce 9 new array input types, and 8 additional quadratic sorting algorithms
Oct 7, 2024
Unbreakable-Syntax
changed the title
Introduce 9 new array input types, and 8 additional quadratic sorting algorithms
Introduce 9 new array input types, and 9 additional sorting algorithms
Oct 8, 2024
Unbreakable-Syntax
changed the title
Introduce 9 new array input types, and 9 additional sorting algorithms
Introduce 9 new array input types, and 10 additional sorting algorithms
Oct 9, 2024
Unbreakable-Syntax
changed the title
Introduce 9 new array input types, and 10 additional sorting algorithms
Removed compilation warnings. Introduce 9 new array input types, and 10 additional sorting algorithms.
Oct 9, 2024
Credits to @MusicTheorist for the Quicksort Killer input
Unbreakable-Syntax
changed the title
Removed compilation warnings. Introduce 9 new array input types, and 10 additional sorting algorithms.
Removed compilation warnings. Introduce 10 new array input types, and 11 additional sorting algorithms.
Oct 10, 2024
Credits to @w0rthy, and "The Studio" Discord channel for teaching me how the major methods work!
Unbreakable-Syntax
changed the title
Removed compilation warnings. Introduce 10 new array input types, and 11 additional sorting algorithms.
Removed compilation warnings. Introduce 10 new array input types, and 12 additional sorting algorithms.
Oct 10, 2024
This change allows the application to display as much as 8192 elements without the visualization going past the screen borders. It is possible to go past 8192 elements, but the application will lag at this point. 0.2 downscaling will not work for displaying large array sizes, 0.1 downscaling will allow displaying up to 12000 array elements, but again, this will cause huge lag.
This change complements the aggressive bar width downscaling change.
Reverted the normal calculation back to the original formula, this gives the best of both worlds. Array sizes within the 1000 range will not upscale past the application window border, and array sizes of 2000 and above will also never go past the window border. This should stabilize the aggressive downscale solution even more.
This introduces some corrections: 1. The SoundCallback() method is not apparently being detected, even if it is declared in SortSound.cpp, the reason for this is because the middle argument on the declaration of SoundCallback() is different compared to how it is defined in SortSound.cpp. Even if unsigned char is the same as Uint8, C++ still treats the 2 types as different, hence it says that SoundCallback() cannot be found. Therefore, the SoundCallback() declaration should match its definition, which is what this change introduces. 2. The constructor for SortAlgoThread is apparently not being detected properly by WSortView.h, even if it is properly declared in WSortView.cpp, the apparent cause of this is because there are 2 missing semicolons, one from the class declaration, and one from the END_EVENT_TABLE() above the constructor declaration. This change adds this 2 missing semicolons, making the constructor declaration to be finally detected. 3. DECLARE_EVENT_TABLE() apparently should not have a semicolon. Before, DECLARE_EVENT_TABLE() is not being detected because there is a semicolon after it, which is wrong. This change removes those semicolons so that DECLARE_EVENT_TABLE() is now finally detected.
Unbreakable-Syntax
changed the title
Removed compilation warnings. Introduce 10 new array input types, and 12 additional sorting algorithms.
Removed code formatting and compilation warnings. Introduce 10 new array input types, and 12 additional sorting algorithms.
Oct 11, 2024
Since decimal places are not considered for speed delays anymore in 1 ms and above, it is best not to show them anymore, as they could just lead to confusion.
Wrong placement
This should allow the visualizer to be more compatible now. With this change, the project should now compile under at least C++11
This should allow all higher Median of N implementations to perform at least a little better due to higher threshold (previous * 2), since clustering has even lesser chances of happening, especially the randomized variants.
Credits to @Taihennami on "The Studio" Discord for introducing me to this great minimum threshold formula, as well as introducing me to using Shell Sort for sorting n = 11. The minimum threshold for all higher Median of N is now (n * n), such as 5 * 5 = 25, or n^2, this should allow all higher Median of N pivot rules to perform faster on small array sizes due to having less overhead, as well as providing better pivot selection when the boundary is high enough.
This should be the last pivot rule I will ever implement. Assuming that I will implement Median of Medians properly, then I will add it too, but this is not going to be my main focus now. I suppose I will now aim towards adding more sorting algorithms.
Since watch() in this fork never expects a volatile variable anymore, and all Quick Sorts here use a separate watched std::atomic<ssize_t> variable, the typecasting fix provided earlier is of no use now.
I almost forgot to convert this sorting algorithm, my bad.
This should allow for more predictable behavior.
After some research, I am able to conclude that delay * 1000 isn't going to cause any overflow here in most cases, especially considering that a double can hold an even larger value than an int. But, in case microDelay somehow holds an infinite value, then the additional condition will ensure that microDelay will be set to the max value that a double can hold to ensure that proper comparison and functionality is still there.
After some research, I am able to conclude that delay * 1000 isn't going to cause any overflow here in most cases, especially considering that a double can hold an even larger value than an int. But, in case microDelay somehow holds an infinite value, then the additional condition will ensure that microDelay will be set to the max value that a double can hold to ensure that proper comparison and functionality is still there.
I am very much bothered with just the microsecond loop interval only. The reason why it's bothering me so much is that, say, someone allowed 60000 ms in the visualizer, 60000 * 1000 = 60000000, which means the microsecond loop would have to perform a total of 60 million evaluation and incrementation which isn't really good. A previous solution I had was to simply ignore the decimal part and use millisecond interval, so instead of 60 million, only 60000 checks would be performed, but this isn't very good as well since the visualizer fully interprets the decimal part of the ms value. This struggle finally ends today, finally! The DoDelay() method now has 2 loops, one for the whole number value, and the other one for the fractional value. If the delay for example is set to 1.89 ms, if only the microsecond loop is used, this would result in 1890 iterations in total, with this hybrid approach, only 891 iterations (1 for millisecond, .89 * 1000 = 890 for microsecond) are done which is a good improvement! This slash in iterations becomes more noticeable the larger the ms value is. For example, with 14.89 ms, the resulting iterations with microsecond loop only would be 14890 iterations, with this hybrid approach, it only becomes 904 iterations (.89 * 1000 = 890 + 14) only! Now I can finally rest easy.
The wxMilliSleep() converts a decimal value such as 0.1 to just 0, so in the else block, since wxMilliSleep receives a truncated delay, it effectively does the same thing.
Since the fractional ms value will never go past 1.0, the check condition is not needed now,
Unbreakable-Syntax
changed the title
Fixed code formatting, errors, and compilation warnings. Introduce 17 new array input types, and 23 additional sorting algorithms. Allowed larger array sizes to not go past the window borders of the program, among several other changes.
Fixed code formatting, errors, and compilation warnings. Introduce new array input types, and additional sorting algorithms. Allowed larger array sizes to not go past the window borders of the program, among several other changes.
Nov 12, 2024
Unbreakable-Syntax
changed the title
Fixed code formatting, errors, and compilation warnings. Introduce new array input types, and additional sorting algorithms. Allowed larger array sizes to not go past the window borders of the program, among several other changes.
Fixed code formatting, errors, and compilation warnings. Introduce new array input types, and additional sorting algorithms. Larger array sizes are now properly displayed, among several other changes.
Nov 12, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I have a huge appreciation for this project, and now I want to introduce a lot of changes and improvements! I really hope this will be accepted.
New array input types:
Credits to @MusicTheorist
Credits to the ArrayV project
These array input types could pose a challenge on some sorting algorithms such as Single Pivot Quick Sort.
I have fine-tuned the array generation for these new input types, these input types should work properly regardless of input size.
Additional sorting algorithms:
This is a version of Pancake Sort that searches for the maximum element in n/2 time, allowing for slightly faster sort time
Based on my current implementation of Cocktail Twister Sort
This is a variant of Gnome Sort that uses a jump/leap optimization
Obtained from here
Credits to @Taihennami
To alter between 2 bases, go to the InPlaceRadixSortLSD() method and modify the value of size_t bucket.
Credits to @w0rthy, and "The Studio" Discord channel for teaching me how the major methods work!
Credits to @aphitorite
Credits to @EmeraldBlock
Credits to @aphitorite for these 4 sorting algorithms starting from Weave Merge to Buffer Partition
Credits to @aphitorite and @Flanlaina
I recommend not removing the original variants (such as Gnome Sort and Bubble Sort) for demonstration and educational purposes.
New Quick Sort pivot rules:
Inspired on the idea of Median of Fifteen in Flux Sort by @scandum
Credits to the developers of Flan Sort @aphitorite and @Flanlaina
Project enhancements:
Bug fixes and warning reductions:
Miscellaneous changes:
The reason why this PR looked massive is because I made the pull request early on, and then I made several other changes as time went by. If it is desired to check out individual changes, then please see the commit history of my fork (200+ commits) to see all the changes I made.
If this is going to be done, then please pay attention only on the enhancements, bug fixes, warning reductions, and miscellaneous changes. All commits related to additional sorting algorithms, array input types, and pivot rules, as well as changes made to these additions, can be safely ignored.
I hope all these changes will be considered please! I spent a lot of time making sure that all my additions are not broken by testing it as much as possible. I also spent a lot of time debugging and fixing all the errors and warnings I could find too.
It has been an honor! I am happy to make this project evolve and improve so much.