홈 > Term: bag
bag
An unordered collection of values that may have duplicates. Formal Definition: A bag has a single query function, numberIn(v, B), which tells how many copies of an element are in the bag, and two modifier functions, add(v, B) and remove(v, B). These may be defined with axiomatic semantics as follows.
- new() returns a bag
- numberIn(v, new()) = 0
- numberIn(v, add(v, B)) = 1 + numberIn(v, B)
- numberIn(v, add(u, B)) = numberIn(v, B) if v ≠ u
- remove(v, new()) = new()
- remove(v, add(v, B)) = B
- remove(v, add(u, B)) = add(u, remove(v, B)) if v ≠ u
- 품사: noun
- 분야/도메인: 컴퓨터 과학
- 카테고리: Algorithms & data structures
- Government Agency: NIST
0
작성자
- GeorgeV
- 100% positive feedback