Go sort Package IntsAreSorted()

Description

Go sort Package IntsAreSorted()

package main// ww  w .  j av a 2  s  .  com

import (
  "fmt"
  "sort"
)
func main() {
  num := []int{3,2,6,1,9,3}
  fmt.Println(num)  

  if sort.IntsAreSorted(num)==false{
    sort.Ints(num)  // Sort Integer Array
  }
  fmt.Println(num)
  fmt.Println(sort.SearchInts(num,30))

}



PreviousNext

Related