Algorithms Flashcards

1
Q

Explain Abstraction

A

Abstraction focuses on reducing complexity. This could be through ignoring unimportant details or through the hiding of complexity. Functions and procedures can be used to hide the finer details of an algorithm and data structures can also be used to hide complexity.

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

S1 = {m,n,p}

S2 = {m,n}

S3 = {1,2,3,4}

S4 = {0,1,2}

S5 = {m, mn, mp}

S6 = {r}

S7 = {m,n,p}

S8 = {p}

Describe, using example sets, the difference between a subset of S1 and a proper subset of S1

A

A subset of S1 is any set that contains only values from S1 (1), e.g. S2/S7/S8 A subset of S1 is any set that contains only values from S1, but does not contain all values from S1. A proper subset of S1 is any set that contains some but not all values from S1 and nothing else. For example: S2 or S8.

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

S1 = {m,n,p} S2 = {m,n} S3 = {1,2,3,4} S4 = {0,1,2} S5 = {m, mn, mp} S6 = {r} S7 = {m,n,p} S8 = {p} State the name of a set that has the same cardinality as S1 but is not a subset of S1

A

S4 or S5

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

S1 = {m,n,p} S2 = {m,n} S3 = {1,2,3,4} S4 = {0,1,2} S5 = {m, mn, mp} S6 = {r} S7 = {m,n,p} S8 = {p} Describe how the set S2 could be created using a difference operation together with two other sets

A

S2 = S1 – S8 S2 = S7 – S8 S1 – S8 S7 – S8 {m,n,p} – {p}

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

S1 = {m,n,p} S2 = {m,n} S3 = {1,2,3,4} S4 = {0,1,2} S5 = {m, mn, mp} S6 = {r} S7 = {m,n,p} S8 = {p} What is the cartesian product of sets S6 and S2?

A

{ (r,m) , (r,n) } or { (m,r) , (n,r) }

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

Explain cardinality

A

number values in a set

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