Sorting in Go
Posted on March 20, 2020
Go sort package implements sorting for builtins and user-defined types. It’s flexibility makes sorting a breeze!
Sorting a slice full of Strings as simple as using a simple one line
sort.Strings(sliceOfStrings). Below is an example of sorting a few Strings
Sorting ints are just as quick a simple one line of sort.Ints(sliceofints) will sort all of your integers from smallest to largest.
Go has a built in function that will return true or false based upon if a slice is sorted. Adding to the Integer code above, we can tell if the slice is sorted.
That was a quick article of sorting using Go! If you want to learn about looping in Go check out the previous article Looping in Go
I finished the first part of the nanodegree a few days ago and decided to give an indepth review of what is covered, what you learn and what is completed by the end of it.
When you first start thinking about becoming a developer, one of the things you might hear is you need to be a math(s) wizz. I am here to tell you that a small number of developers need the mathematics outside of algebra.