Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

MOGADISHU UNIVERSITY

COMPUTER SCIENCE DEPARTMENT

SAMPLE MIDTERM EXAM


ALGORITHMS
STUDENT NAME: ___________________________________ID#:__________
Note: This Sample Midterm exam contains 20 Questions. Attempt All. Solve each and every
problem step by step
[20 x 1.5 = 30.0 points ]
QUESTIONS
1. Calculate sum of nth term series: T(n) = 6k2–4k + 3
2. Using Geometric series, Prove that :
𝑛
𝑖 2 (𝑛−1) 𝑛
𝑥 (𝑛+1) − 1
𝑆𝑔 = ∑ 𝑥 = 1 + 𝑥 + 𝑥 + ⋯ + 𝑥 + 𝑥 = ,𝑥 ≠ 1
𝑥−1
𝑖=0
3. Using Series Difference. Prove that:
𝑛
𝑛(𝑛 − 1)𝑑
∑ 𝑖 = 1 + 2 + 3+ . . . +8 + 9 + 𝑛 = 𝑎𝑛 +
2
𝑖 =1
4. Using MI, Show the basis step and the general step of 9n, for any integer n ≥ 1,

5. Using Big O Notation, what is the runtime of these statements


for i 1 to n do
for j 1 to n do
for k 1 to n do
x=x+y
x=x-y
x=x*y
6. Compute f(3, 6) for the recursive
−𝟐 𝒂>𝒃
𝒇(𝒂, 𝒃) = { 𝟓 𝒂=𝒃
𝒂 ∗ 𝒇(𝒂 + 𝟏, 𝒃) − 𝟑 𝒐𝒕𝒉𝒆𝒓𝒘𝒊𝒔𝒆

7. Using Mathematical Induction, prove 2 + 7 + 12 + 17 + ... + (5n-3) = n(5n-1)/2 is true for


any integer n ≥ 1
8. Using MI, Show the basis step and the general step of the sequence: -5, -3, -1, 1, 3for
any integer n ≥ 1
9. Compute f(5) for the recursive

Page 1 of 3
𝟒 𝒏=𝟎
𝒇(𝒏) = {
𝒇(𝒏 − 𝟏) + 𝟕 𝒐𝒕𝒉𝒆𝒓𝒘𝒊𝒔𝒆

10.Using Mathematical Induction, prove that :


𝒏
𝒌(𝒌+𝟏)(𝟐𝒌+𝟏)
∑ 𝒊𝟐 = 𝟏 + 𝟒 + 𝟗 + 𝟐𝟕 +. . . = 𝟔
𝒊=𝟏

𝒏(𝒏−𝟏)
11.Using 𝒂𝒏 + 𝒅 formula for the followings show the nth term
𝟐
a. 2 + 9 + 16 + 23 + … +n b. 9 + 12 + 15 + 18 + ...+n

𝟏 𝒏=𝟎
12.Compute f(8) for the recursive 𝒇(𝒏) = {
𝒏 ∗ 𝒇(𝒏 − 𝟏) 𝒐𝒕𝒉𝒆𝒓𝒘𝒊𝒔𝒆

13.What is the output of the following recurrence program if inputs were: 3,9 i.e.:
Compute t(2,9)

14.Using Intelligent Guesswork, Calculate the following recurrence


𝟎 𝒏=𝟎
𝑻(𝒏) = {
𝟏𝟓𝑻(𝒏/𝟐) + 𝒏 𝑶/𝒘

15.Using Mathematical Induction, show the final result of 2n-6 for any integer n ≥ 1
16.Show step by step output of Binary Divide and Conquer multiplication if x = 01111110 and y
= 01110110
17.What is the output of this function if n = 8

Page 2 of 3
18.Using Mathematical Induction, prove that ∑𝒏𝒊=𝟏 𝑖 = 𝟏 + 𝟐 + 𝟑 + 4 +. . . + n = 𝒌(𝒌+𝟏))
𝟐
19.Using Intelligent Guesswork, Calculate the following recurrence
𝟎 𝒏=𝟎
𝑻(𝒏) = {
𝟕𝑻(𝒏/𝟐) + 𝒏 𝑶/𝒘

20.Using x = 12345 and y =9865 calculate step by step the followings:


a. Ala Russe Multiplication
b. Arabic Multiplication
c. British Multiplication
d. Divide and Conquer Multiplication

End of Midterm Exam

Page 3 of 3

You might also like