Skip to content

Instantly share code, notes, and snippets.

View cedricconol's full-sized avatar

Cedric Conol cedricconol

  • Philippines
View GitHub Profile
@cedricconol
cedricconol / swap.go
Created May 5, 2020 08:55
swap function for bubble sort in go
func swap(list []int, firstIndex int) {
list[firstIndex], list[firstIndex+1] = list[firstIndex+1], list[firstIndex]
}
@cedricconol
cedricconol / pass.go
Last active May 5, 2020 08:41
pass function for bubble sort in go
func pass(list []int, ascending bool) {
var N int = len(list)
for i := 0; i < N-1; i++ {
var firstElement int = list[i]
var secondElement int = list[i+1]
if ascending == true {
if firstElement > secondElement {
swap(list, i)