Discover Packages
gitlab.com/luyang93/The-Go-Programming-Language
ch06
ex01
package
Version:
v0.0.0-...-6fe4f4e
Opens a new window with list of versions in this module.
Published: May 11, 2024
License: MIT
Opens a new window with license information.
Imports: 2
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
README
¶
Exercise 6.1 (P167)
Implement these additional methods:
func (*IntSet) Len() int // return the number of elements
func (*IntSet) Remove(x int) // remove x from the set
func (*IntSet) Clear() // remove all elements from the set
func (*IntSet) Copy() *IntSet // return a copy of the set
Expand ▾
Collapse ▴
Documentation
¶
Package intset provides a set of integers based on a bit vector.
An IntSet is a set of small non-negative integers.
Its zero value represents the empty set.
Add adds the non-negative value x to the set.
Clear removes all elements from the set
Copy return a copy of the set
Has reports whether the set contains the non-negative value x.
Len return the number of elements
String returns the set as a string of the form "{1 2 3}".
UnionWith sets s to the union of s and t.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.