Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Divisional Competition
(ID Number):
___________________________________________________
(Name):
___________________________________________________
(Class):
___________________________________________________
(Institution):
___________________________________________________
: (Phone):
___________________________________________________
(E-mail):
___________________________________________________
(Instructions):
(You can answer either in
.
Bangla or English.)
.
.
(Topics mentioned
under Required knowledge are described at the end of the question paper.)
.
(Partial
answers will also be evaluated, so we encourage you to answer as much as you can.)
marks.)
1
Question 1:
? (You are
given an even number N, Find the summation of all even numbers between 1 and N)
(Write the general formula) [10]
i)
ii)
iii)
iv)
Question 2:
(Required Knowledge):
(Binary Numbers)
B
V
0
1)
0
X (X
number B and a value V. At the beginning V is 0. Starting from left to right for every digit of the binary
number you will change that value of V. Suppose the next digit is X ( X is obviously 0 or 1).You will
change V in the following process)
V
of V)
(Previous Value
(Value of X)
B=110
)
V=0
1
V=0
X=1 ,
V=1
1.
V=1
X=1,
V=0
V=0
X=0,
V=0
(New Value of V)
2
(Suppose B=110.Then at the beginning V=0;
1) Leftmost digit is 1. As X=1 and V=0 , so now V=1.
2) Next digit is 1.As X=1 and V=1 , now V will be 0
3) Next digit is 0. As X=0 and V=0 , now V will be 0.
So final value of V is 0.)
i) B
(Propose a general
method to find the final value of V for any binary number B) [10]
ii) V
B 1234
B 123456789101112
and 1. For example, 0011, 0, 1, 110, 1010, 1111 are some bit strings. How many bit strings of
length N has more 1s than 0s?)
i) N=3
ii) N=10
iii) N=500
iv) N
Question 4:
(Required Knowledge):
(Tree)
,
(You are given a rooted tree with N nodes. You are currently in the root. You want to visit all the
nodes of the tree at least once. You need one second to go from one node to an adjacent node)
i)
,
?
N (How much
N (Find the
iii)
(i)
Figure Q4(iii)
(ii)
Question 5::
(Required Knowledge):
/
(Stack/Queue)
popS
pushQ(X)
popQ
[2,1]
[2,1]
pushS(X) X
X
pushS(1)
pushS(3)
pushS(2)
[3,2,1] popS
[1,2,5] popQ
[2,5]
,
(You are given a stack and a
queue. Given functions are pushS(X) which pushes the value X in top of the stack, popS which pops the
value from stack top, pushQ(x) which pushes the value X in back of the queue and popQ which pops the
value in front of the queue. For example, if we execute pushS(1) and pushS(2) the stack will look like [2,1]
from top to bottom. And then if we pushS(3) then the stack becomes [3,2,1]. After a popS it becomes
[2,1]. Similarly for pushQ(1), pushQ(2) and pushQ(5) the queue looks like [1,2,5] from front to back. After
a popQ it becomes [2,5]. Now given a set of instructions executed one after one, write the condition of the
stack and queue after executing each instructions. the first two is done for your convenience) [20]
4
i) pushS(1) Answer: [1],[]
ii) pushS(2) Answer: [2,1],[]
iii) pushQ(5)
iv) popS
v) popQ
vi) pushQ(10)
vii) pushS(3)
viii) pushQ(20)
ix) pushS(popQ)
x) popS
xi) popS
xii) popQ
Question 6:
(Required Knowledge):
/
(Stack/Queue)
reverse(k)
[1,3,5,4,6], reverse(3)
[5,3,1,4,6].
reverse(2)
[1,3,4,5,6]
[1,3,5,4,6]
[1,7,5,2,4,3,6]
[1,7,5,2,4,3,6]) [7]
(Write the general steps to solve the problem) [13]
ii)
Question 7:
(Required Knowledge):
(Recurrence Relation)
i) b(n)
ii) a(n)
(The definition of
n = 2, k = 2
n = 5, k = 3
Question 8:
(Required Knowledge):
(Recurrence Relation)
n
(How many n-digit numbers are there, where the sum of every adjacent digit is less than or equal to 3?)
n=3
30
[000, 001, 002, 003, 010, 011, 012, 020, 021, 030, 100, 101, 102, 103, 110, 111,112, 120, 121, 200, 201,
202, 203, 210, 211, 212, 300, 301, 302, 303]
i) n = 4
ii) n = 7
iii)
Question 9::
x
5
5
5
1
1*2=2 5
2 5
2
1
(1
5)
12
12
1, 2, 3 12 1,2
3*2=6 12
12
3
6
(1, 2, 3, 4, 6
12)
?
[5]
1
2
100
[15]
(Professor K invented a process to find how many factors (divisors) are there of a number n. The process
is:
Find out the number of positive integers between 1 and the square root of n, which are factors of
n. Let this value to be x.
For example: For n = 5, Only 1 and 2 is less than the square root of 5. Of them only 1 divides 5. So
according to the process of professor K the number of factors is 1*2 = 2. 5 has 2 divisors (1 and 2)
For n = 12, Only 1, 2 and 3 are less than the square root of 12. Of them 1, 2 and 3 divides 12. So
according to the process of professor K the number of factors is 3*2 = 6. 12 has 6 divisors (1, 2, 3, 4, 6,
12)
Do you think professor Ks process is correct?
1 If not, show an example for which the process will fail. [5]
2 For how many numbers between 1 and 100 this process will fail?) [15]
Question 10::
n
k
PP.P(
n = 4, k = 3, m = 2
)
i) n, m
ii) n = 5, k = 3, m = 2 [3]
iii) n = 1000000000, k = 30, m = 25 [5]
PP..
[12]
7
(n pigeonholes are kept side by side in a row. You want to put pigeons in some of the holes in a way that
for every k consecutive holes there will be exactly m holes with a pigeon. There shouldnt be more than
one pigeon in a hole.
For example:
For n = 4, k = 3, m = 2, a solution can be PP.P(Here P means a pigeon and . means a hole). But
.PPP, PPP., P.P. or PP.. arent solutions.
i) Write a general formula to find the number of solutions for n, m and k. [12]
ii) n = 5, k = 3, m = 2 [3]
iii) n = 1000000000, k = 30, m = 25 [5]
(Appendix)
(Recurrence Relation)
,
(In mathematics, a recurrence relation is an equation which defines a sequence where one or more initial
terms are given and each further term of the sequence is defined as a function of the preceding terms.)
,
T(n)
15
31
63
127
T(n)
2 -1
value of T(n) is 2 -1 which is true. You can prove it using mathematical induction. One well known
recurrence relation is the Fibonacci sequence.)
(Binary Numbers)
8
(Its possible to uniquely express any number as a sum of one or more power(s) of two. We
can express the number as a sum of each used powers of two multiplied by 1 and each unused powers
multiplied by 0. Youll get a better idea from the following example)
11 = 8 + 2 + 1 =1 * 2^3 + 0 * 2^2 + 1 * 2^1 + 1 * 2^0 = 1011 in Binary
10
10
11
100
101
110
111
1000
1001
1010
(Binary)
(Stack)
Pop
Pop
[1, 2]
Push
[2] Push(3)
1
[3,2]
to put a new book in the pile we put the book on the top and if we remove one we remove from the top
too. Here putting something is called Push and removing is called pop. For example, if we have a stack
[1,2] where 1 is the topmost item. If you pop we will get 1 and the stack becomes [2]. After Push(3) the
stack becomes [3,2]. Thats why stacks operation is called Last in first out)
(Queue)
Push
Pop
[1, 2]
1
[2,3]
Pop
[2] Push(3)
(Queue can be compared
with a line in front of a bus counter where a new person stand in the back of the line and the ticket is
given to the person in the front of the line. Here standing in the back is called Push and giving ticket to the
front person is called Pop. For Example, we have a queue [1,2] where 1 is the front item. If we Pop we
will get 1 and the queue becomes [2]. If we Push(3) then the queue becomes [2,3]. This nature of queue
is called First in first out)
(Node):
(Edge):
(The
(Root):
(A
(The idea
n-1