MCPcopy
hub / github.com/TheAlgorithms/Go / IsSubsetOf

Method IsSubsetOf

structure/set/set.go:84–95  ·  view source on GitHub ↗
(superSet Set[T])

Source from the content-addressed store, hash-verified

82}
83
84func (st *set[T]) IsSubsetOf(superSet Set[T]) bool {
85 if st.Len() > superSet.Len() {
86 return false
87 }
88
89 for _, item := range st.GetItems() {
90 if !superSet.In(item) {
91 return false
92 }
93 }
94 return true
95}
96
97func (st *set[T]) IsProperSubsetOf(superSet Set[T]) bool {
98 if st.Len() == superSet.Len() {

Callers 1

IsProperSubsetOfMethod · 0.95

Calls 4

LenMethod · 0.95
GetItemsMethod · 0.95
LenMethod · 0.65
InMethod · 0.65

Tested by

no test coverage detected