Assignment 1
P58/76089/2012
a) Let English speakers be A and Swahili Speakers be B
Therefore,
Card(A)=400
Card(B)=300
(i)
Card(A u B) =Card(A)+Card(B)-Card(A n B)
500=400 + 300 - Card(A n B)
500=700 - Card(A n B)
Card(A n B)=700-500=200
Card(A n B)=200
Therefore those that can speak both languages are 200.
(ii)
Card (A u B)-Card (A n B)
=500-200
=300.
b)
(i)
ƒ:N―›N
ƒ(n)=n div 3
-Injective . The partial function maps one natural number to one natural number
where it is defined.
- surjective. Every element of Cod(ƒ) is a vale of f(n).
-Bijective. Since it is both injective and surjective.
(ii)
g:N―›N
g(n)=n2 + 2n + 1 -Injective . The f(n) function maps one natural number from Dom(g) to one natural
number in the Cod(g) where it is defined.
It is not surjective because 0 is not a value of f(n) but is an element of Cod(f)
-Not Bijective
(iii)
h:∑*―› ∑* where {a,b}
h (w)=ana(w)
-Not Injective –Maps more than 1 elements of dom(h) to one element of to 1 and same
element of cod(h).
-Not surjective –some elements of ∑* are not values of h (w).
- Not Bijective
c) Let C1 and C2 be members of natural number N such that C1, C2 ≥1.
ƒ(n) =O(h (n)) can be written as ƒ(n) ≤C1(h (n))
g(n) =O(h (n)) can be written as g(n) ≤C2(h (n))
Therefore ƒ(n) + g(n) ≤ C1(h (n)) + C2(h (n))
≤ (C1 + C2)(h (n))
If there exists a constant k =C1+c2 then
ƒ(n) + g(n) ≤ (C1 + C2)(h (n))
≤ k(h (n))
O(h(n))
1:L
f(n) = n2
d)
16
B:R
1:R
B:L
B:L
17
15
14
1:R
0
1:R
2
1:R
1:R
5
B:L
1
B:R
1:L
1:B
9
22
1:R
B:L
B:1
B:1
7
B:R
1:B
31
1:R
B:L
37
1:L
24
1:L
28
26
25
32
36
43
1:B
1:L
1:L
1:R
40
1:B
1:R
B:L
B:L
33
B:R
27
1:B
35
1:R
38
B:1
B:R
44
1:R
1:R
1:R
45
1:R
48
B:R
B:R
1:B
42
B:R
34
49
41
1:R
B:R
39
B:R
1:R
B:1
1:L
B:L
B:L
30
29
1:R
1:R
26
B:L
B:1
25
1:L
B:L
1:L
B:L
1:L
B:L
3
B:L
23
24
6
1:L
1:R
8
B:R
4
B:1
B:R
1:R
21
1:L
B:L
13
B:R
20
12
10
1:R
1:L
1:R
1:B
B:R
1:R
18
B:R
11
19
B:L
B:1
B:1
46
B:L
47
e)
Alphabet ∑ {a,b} and Language of length 3 or more.
a:B
B:R
E
1
0
a:B
a:B
b:B
2
3
b:B
B:R
E
4
B:R
E
5
6
b:B
a:B
b:B
B:1
3
f)
Language {anbam|n,m>≥0}.
1
B:R
B:R
4
a:B
a:B
0
b:B
2
B:R
3
B:1
5
7
B:R
E
g)
a:R
B:a
10
a:R
B:L
9
8
b:R
B:R
4
B:a
b:R
B:L
a:B
a:L
a:R
b:B
7
b:L
2
B:R
b:R
16
a:B
6
a:B
0
B:a
a:R
a:R
1
17
3
B:b
b:R
B:L
B:b
12
14
1
11
1
15
b:B
B:b
B:R
15
B:L
15
b:B
a:B
15
a:L
B:L
B:R
15
b:R
b:B
5
13
B:R
b:L
15
λ:R
B:L
15
© Copyright 2026 Paperzz