Algorithms Flashcards
Explain Abstraction
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.
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 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.
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
S4 or S5
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
S2 = S1 – S8 S2 = S7 – S8 S1 – S8 S7 – S8 {m,n,p} – {p}
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?
{ (r,m) , (r,n) } or { (m,r) , (n,r) }
Explain cardinality
number values in a set