Skip to content
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

fix: [generic + sort] All ready for generics #483

Merged

Conversation

tjgurwara99
Copy link
Member

Beginning of Generics in Go. A relatively simple PR to include some examples use cases of Generics in sort. Was not able to actually convert some of the sort algorithms due to their intrinsic dependence on type int.

Copy link
Member

@raklaptudirm raklaptudirm left a comment

Choose a reason for hiding this comment

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

Ignore this lol

raklaptudirm
raklaptudirm previously approved these changes Mar 25, 2022
Copy link
Member

@raklaptudirm raklaptudirm left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@cclauss cclauss left a comment

Choose a reason for hiding this comment

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

Nice!

sort/mergesort.go Outdated Show resolved Hide resolved
sort/quicksort.go Outdated Show resolved Hide resolved
sort/sorts_test.go Outdated Show resolved Hide resolved
@tjgurwara99 tjgurwara99 merged commit 322859f into TheAlgorithms:master Mar 26, 2022
func Count(data []int) []int {
import "github.com/TheAlgorithms/Go/constraints"

func Count[T constraints.Number](data []int) []int {
Copy link

Choose a reason for hiding this comment

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

why isn't this

func Count[T constraints.Number](data []T) []T {

?

Copy link
Member Author

Choose a reason for hiding this comment

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

Primarily because I missed it... Feel free to open a PR to rectify it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants