- Sort Score
- Result 10 results
- Languages All
Results 21 - 30 of 1,614 for qsort (0.07 sec)
-
src/sort/example_search_test.go
// license that can be found in the LICENSE file. package sort_test import ( "fmt" "sort" ) // This example demonstrates searching a list sorted in ascending order. func ExampleSearch() { a := []int{1, 3, 6, 10, 15, 21, 28, 36, 45, 55} x := 6 i := sort.Search(len(a), func(i int) bool { return a[i] >= x }) if i < len(a) && a[i] == x { fmt.Printf("found %d at index %d in %v\n", x, i, a)
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu Mar 18 08:25:24 UTC 2021 - 2.1K bytes - Viewed (0) -
src/sort/example_interface_test.go
{"Michael", 17}, {"Jenny", 26}, } fmt.Println(people) // There are two ways to sort a slice. First, one can define // a set of methods for the slice type, as with ByAge, and // call sort.Sort. In this first example we use that technique. sort.Sort(ByAge(people)) fmt.Println(people) // The other way is to use sort.Slice with a custom Less // function, which can be provided as a closure. In this
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Sun Sep 24 14:40:37 UTC 2017 - 1.5K bytes - Viewed (0) -
test/fixedbugs/bug188.go
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu Mar 04 06:36:33 UTC 2021 - 284 bytes - Viewed (0) -
src/cmd/nm/nm.go
"bufio" "flag" "fmt" "log" "os" "sort" "cmd/internal/objfile" "cmd/internal/telemetry" ) const helpText = `usage: go tool nm [options] file... -n an alias for -sort address (numeric), for compatibility with other nm commands -size print symbol size in decimal between address and type -sort {address,name,none,size} sort output in the given order (default name)
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue May 14 19:41:17 UTC 2024 - 3.1K bytes - Viewed (0) -
src/sort/example_wrapper_test.go
{"heart", 290}, {"liver", 1494}, {"pancreas", 131}, {"prostate", 62}, {"spleen", 162}, } sort.Sort(ByWeight{s}) fmt.Println("Organs by weight:") printOrgans(s) sort.Sort(ByName{s}) fmt.Println("Organs by name:") printOrgans(s) // Output: // Organs by weight: // prostate (62g) // pancreas (131g) // spleen (162g) // heart (290g) // brain (1340g)
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Sep 08 04:08:51 UTC 2014 - 1.6K bytes - Viewed (0) -
pkg/config/host/names_test.go
t.Run(fmt.Sprintf("%d", idx), func(t *testing.T) { // Save a copy to report errors with tmp := make(host.Names, len(tt.in)) copy(tmp, tt.in) sort.Sort(tt.in) if !reflect.DeepEqual(tt.in, tt.want) { t.Fatalf("sort.Sort(%v) = %v, want %v", tmp, tt.in, tt.want) } }) } } func BenchmarkNamesSort(b *testing.B) {
Registered: Fri Jun 14 15:00:06 UTC 2024 - Last Modified: Wed Mar 06 10:35:13 UTC 2024 - 4.5K bytes - Viewed (0) -
src/go/scanner/errors.go
} return p[i].Msg < p[j].Msg } // Sort sorts an [ErrorList]. *[Error] entries are sorted by position, // other errors are sorted by error message, and before any *[Error] // entry. func (p ErrorList) Sort() { sort.Sort(p) } // RemoveMultiples sorts an [ErrorList] and removes all but the first error per line. func (p *ErrorList) RemoveMultiples() { sort.Sort(p)
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu Oct 19 12:02:03 UTC 2023 - 3K bytes - Viewed (0) -
src/go/doc/testdata/examples/issue43658.golden
) if err != nil { log.Fatal(err) } // Print out each step with communities ordered. for _, d := range p { comm := d.Communities() for _, c := range comm { sort.Sort(ordered.ByID(c)) } sort.Sort(ordered.BySliceIDs(comm)) fmt.Printf("Low:%.2v High:%.2v Score:%v Communities:%v Q=%.3v\n", d.Low, d.High, d.Score, comm, community.Q(g, comm, d.Low)) } } // intset is an integer set.
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue May 10 23:13:45 UTC 2022 - 4.5K bytes - Viewed (0) -
src/go/doc/testdata/examples/multiple.golden
-- KeyValueTopDecl.Output -- a: "B", b: 2 -- Sort.Play -- package main import ( "fmt" "sort" ) // Person represents a person by name and age. type Person struct { Name string Age int } // String returns a string representation of the Person. func (p Person) String() string { return fmt.Sprintf("%s: %d", p.Name, p.Age) } // ByAge implements sort.Interface for []Person based on
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue May 10 16:17:51 UTC 2022 - 1.8K bytes - Viewed (0) -
src/sort/sort_impl_go121.go
// slices package to implement some `sort` functions faster. However, until // the bootstrap compiler uses Go 1.21 or later, we keep a fallback version // in sort_impl_120.go that retains the old implementation. package sort import "slices" func intsImpl(x []int) { slices.Sort(x) } func float64sImpl(x []float64) { slices.Sort(x) } func stringsImpl(x []string) { slices.Sort(x) }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri Jul 21 13:00:18 UTC 2023 - 876 bytes - Viewed (0)