Skip to content

Add Go language to bubble sort #157

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

Merged
merged 4 commits into from
Jun 29, 2018
Merged

Conversation

chin123
Copy link
Contributor

@chin123 chin123 commented Jun 28, 2018

Adds a Go implementation for bubble sort. If you have Go installed, you can do go run bubbleSort.go
Edit: Also I'm not sure whether I'm supposed to add myself to the Contributors list yet, so I haven't.

@Butt4cak3 Butt4cak3 added the Implementation This provides an implementation for an algorithm. (Code and maybe md files are edited.) label Jun 28, 2018
Copy link
Contributor

@zsparal zsparal left a comment

Choose a reason for hiding this comment

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

Apart from the two nitpicks about fmt.Println it seems good


func main() {
array := [10]int{1, 45, 756, 4569, 56, 3, 8, 5, -10, -4}
fmt.Println("Unsorted array:")
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not just fmt.Println("Unsorted array: ", array)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've changed it to this format in both the cases, thanks!


bubbleSort(array[:])

fmt.Println("Sorted array:")
Copy link
Contributor

Choose a reason for hiding this comment

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

Similarly, why not just: fmt.Println("Sorted array: ", array)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, its simpler this way, I changed it. Initially it was like that because I wanted it to be like the output format of the C bubble sort.

@zsparal zsparal merged commit 320c980 into algorithm-archivists:master Jun 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Implementation This provides an implementation for an algorithm. (Code and maybe md files are edited.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants