Go Array is Int Array Sorted

Description

Go Array is Int Array Sorted

package main/*w w w.j  a  v  a 2 s  .  c  om*/

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