Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add support for using merge sort on generic objects implementing the … #7

Merged
merged 1 commit into from
Nov 3, 2018

Conversation

Wyvernix
Copy link
Contributor

…Comparable interface.

The method was implemented using the existing methods as template. This is in reference to issue #3.

@abranhe
Copy link
Owner

abranhe commented Oct 20, 2018

Hey, @Wyvernix thanks for checking out the project and being interested in contribute it it, I looked over it and it seems right, I would like to include generics for most of the algorithms.

Before merging the pull request, a few tests will be required, testing char, string, float, etc. Fell free to remove the methods I created since using a generic method you will be able to use it with int and double.

@abranhe
Copy link
Owner

abranhe commented Oct 23, 2018

@Wyvernix I saw you added more methods for other data types, what about generics? What do you think: is it necessary to add more methods covering those data types, or rather just one generic method that will cover all of them?

I am not sure yet what's gonna be better for other to use this library, with a generic method or using more methods as you did. Please share your thoughts.

…e Comparable interface.

Added merge sort implementations for missing primitive types: byte, char, float, short, and long.
Added test cases for each type.
@Wyvernix
Copy link
Contributor Author

The issue with just adding the generic method to the class as I did is it does not support primitive arrays. It is not possible to call the generic method using an array of integers, for example. In order to support both Object arrays and primitive arrays in Java, both methods are required. An example in the official Java source code can be seen here : DualPivotQuicksort.java

Copy link
Owner

@abranhe abranhe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for your contribution again. Without people like you submitting pull requests we couldn't run this project. Make sure you star ⭐️ this project and follow @abranhe

@Wyvernix I guess so far it is good!

@abranhe abranhe merged commit 5499688 into abranhe:master Nov 3, 2018
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants