Sets Flashcards

1
Q

What is specification?

A

Description of what the type does and the method it provides to do it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is implementation?

A

Code that actually does the work

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a set?

A

A set is a group of things, either related or unrelated.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Does a set have to contain a group of things which are related?

A

No, it the set can contain either related or unrelated elements.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Does the order within a set matter?

A

No

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Do sets contain duplicates?

A

No

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What does ‘aEs’ mean?

A

‘a’ is a member of set ‘s’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What does ‘4E{1,2,3,4}’ mean?

A

‘4’ is a member of set ‘{1,2,3,4}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What would you change to ‘12E{1,2,3,4}’ to show that 12 is not part of the set.

A

Put a horizontal line through the E-like shape

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does ∅ signify?

A

An empty set or a null set.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is U?

A

The universal set

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

{1,2,3,4,5} = {3,2,4,1,5}

Is this correct?

A

Yes, they both equal each other despite the differing order.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

{1,2,3,4,5} = {1,2,3,3,4,2,1,5}

Is this correct?

A

Yes, because within sets duplicates are not important.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

{1,2,3,4} = {1,2,3,4,5}

Is this correct?

A

No, for they do not contain the same elements.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q
S = {2,3,4,5}
T = {1,2,3,4,5,6}

Which, if any, is the subset?

A

S is the subset as all of its elements are contained with T.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What does an underline ‘c’ symbol indicate?

For example, XcV?

A

It indicates that the first set is a subset of the second set.
X is a subset of V.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

How would you indicate that X is not a subset of V?

A

XcV with ‘c’ being underlined and a horizontal line going though it.

18
Q
S = {1,2,3}
T = {1,2,3,4}

Is S a subset or also a proper subset of T?

A

S is a proper subset of T because it does not equal itself.

19
Q

Can S be a subset of S?

A

Yes, all sets can subsets of themselves.

20
Q

What is the powerset of B = {1,2}?

A

P(B) = { {}, {1}, {2}, {1,2} }

21
Q

What is the powerset of C = {1,2,3}

A

P(C) = { {}, {1}, {2}, {3}, {1,2}, {2,3}, {1,3}, {1,2,3} }

22
Q

What is the powerset of D = {Coleraine, Belfast}

A

P(D) = { {}, {Coleraine}, {Belfast}, {Coleraine, Belfast} }

23
Q

What does |A| mean?

A

The cardinality of A ie the number of elements in set A.

24
Q

What is the cardinality of A = {1,2,3,4,5}

A

|A| = 5

25
Q

What is the cardinality of S = { ∅, {A}, {B}, {A,B} }?

A

|S| = 4

26
Q

{1,2,3}U{3,4,5} = ?

A

{1,2,3,4,5}

27
Q

{1,2}U∅ = ?

A

{1,2}

28
Q

{1,2,3}n{3,4,5} = ?

A

{3}

29
Q

{1,2}n∅ = ?

A

30
Q

What is a disjoint set?

A

Disjoint sets have no elements in common.

31
Q

{1,2,3} - {3,4,5} = ?

A

{1,2}

32
Q

What does (AUB)’ mean?

A

’ means complement.

This means that everything that not within the A and B union.

33
Q

What is the difference between a set and a multiset?

A

In a set, duplicates are not allowed.

In a multiset, duplicates are allowed.

34
Q

Is {1,2,3,4,4} a set or a multiset?

A

A multiset because it has duplicates.

35
Q

{a,a,a,b,b,c,c,d,d,d}

What is the multiplicity of a?

A

3

36
Q

{a,a,a,b,b,c,c,d,d,d}

What is the multiplicity of d?

A

3

37
Q

{a,a,a,b,b,c,c,d,d,d}

What is the cardinality of the above multiset?

A

10

38
Q

{1,3,6,1,3,1}U{1,7,6,1,3,6} = ?

A

{1,1,1,3,3,6,6,7}

Only the max number of values from the multiset containing the most is taken.

39
Q

{1,3,6,1,3,1}n{1,7,6,1,3,6} = ?

A

{1,1,3,6}

Only the min number of values is taken from each multiset where each multiset has the same value.

40
Q

In an array 0-4, values with a set are ? when

false, true, true, false, true

A

{1,2,4}

41
Q

How could you represent this multiset in an array 0-9?

{2,4,7,2,4,2,4,6,6}

A

{0,0,3,0,3,0,2,1,0,0}