Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

bubble sort code

func Sort(arr []int) []int {
	for i := 0; i < len(arr)-1; i++ {
		for j := 0; j < len(arr)-i-1; j++ {
			if arr[j] > arr[j+1] {
				temp := arr[j]
				arr[j] = arr[j+1]
				arr[j+1] = temp
			}
		}
	}
	return arr
}
Source by github.com #
 
PREVIOUS NEXT
Tagged: #bubble #sort #code
ADD COMMENT
Topic
Name
3+9 =