File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66 "math"
77)
88
9- // Create, combine, compare and print bit arrays .
9+ // Create, combine, compare and print bit sets .
1010func Example_basics () {
1111 // Add all elements in the range [0, 100) to the empty set.
1212 A := new (bit.Set ).AddRange (0 , 100 ) // {0..99}
@@ -30,7 +30,7 @@ func Example_basics() {
3030
3131// Create the set of all primes less than n in O(n log log n) time.
3232// Try the code with n equal to a few hundred millions and be pleasantly surprised.
33- func Example_eratosthenes () {
33+ func Example_primes () {
3434 // Sieve of Eratosthenes
3535 const n = 50
3636 sieve := bit .New ().AddRange (2 , n )
Original file line number Diff line number Diff line change 1111//
1212// Bit set
1313//
14- // A bit array , or bit set , is an efficient set data structure
14+ // A bit set , or bit array , is an efficient set data structure
1515// that consists of an array of 64-bit words. Because it uses
1616// bit-level parallelism, limits memory access, and efficiently uses
1717// the data cache, a bit set often outperforms other data structures.
1818//
19+ // Tutorial
20+ //
21+ // The Basics example shows how to create, combine, compare and
22+ // print bit sets.
23+ //
24+ // Primes contains a short and simple, but still efficient,
25+ // implementation of a prime number sieve.
26+ //
27+ // Union is a more advanced example demonstrating how to build
28+ // an efficient variadic Union function using the SetOr method.
29+ //
1930package bit
2031
2132import (
You can’t perform that action at this time.
0 commit comments