0% found this document useful (0 votes)
16 views

MAD101-SU24 Assignment2

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

MAD101-SU24 Assignment2

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Discrete Mathematics - MAD101

Assignment 2

SUMMER 2024 Date: 6/17/2024

Question 1: Devise an algorithm that finds the sum of all the integers in a finite list.
Question 2: List all the steps used to search for 9 in the list: 1, 2, 4, 5, 7, 8, 9, 16 using a linear search and a
binary search.
Question 3: Use the greedy algorithm to make change using quarters, dimes, nickels and pennies for 1016
cents.
Question 4: Find the least integer n such that f (x) is O(xn ) for each of these functions:

x4 + 3x2 − 2x + 1
a)f (x) = b)f (x) = 2x .
x2 (log x)5 + 2x + 1

Question 5: Find the number of operations (additions and multiplications) used in this segment of an algorithm:

t := 0
for i := 1 to 3
for j := 1 to 4
t := t + ij

Question 6: Find the largest n for which one can solve within one second a problem using an algorithm that
requires f (n) bit operations, where each bit operation is carried out in 10−9 seconds, with these functions f (n)?

a)f (n) = log n b)f (n) = 2n2

Question 7: How much time does an algorithm using 250 operations need if each operation takes these amounts
of time?

a)10−6 b)10−12

Question 8: Find a div m and a mod m if a = −116 and m = 6.


Question 9: Find the integer a such that

a ≡ 43(mod 23), −22 ≤ a ≤ 0.

Question 10: Find x2 if x0 = 3 and

xn+1 = (4xn + 1) mod 7, n ≥ 0.

Question 11: Determine whether the following set of integers is pairwise relatively prime: 8, 9, 11, 13, 16.
Question 12: Determine gcd(1000, 625) and lcm(1000, 625).
Question 13: Find the base 5 expansion of (1289)10 .

1
Question 14: How many divisions are required to find gcd(22, 63) using the Euclidean algorithm.
Question 15∗ : Use mathematical induction to prove that

n2 (n + 1)2
13 + 23 + . . . + n3 = , n ≥ 1.
4

Question 16: Let P (n) be the statement that a postage of n cents can be formed using just 3-cent stamps and
5-cent stamps. Show that the statements P (8), P (9) and P (10) are true.
Question 17: Find f (1), f (2) and f (3) if f (0) = 2 and

f (n + 1) = f (n)2 − 2f (n) + 2, n ≥ 0.

Question 18: Let S be a set defined recursively by


Basis step: 0 ∈ S
Recursive step: If x ∈ S, then x + 5 ∈ S and x − 5 ∈ S.
Determine S?
Question 19: Consider the following algorithm for computing the Fibonacci numbers (see Section 5.4 in the
student textbook). Find the amount of additions required to compute f6 ?

Question 20: How many positive integers between 100 and 999 inclusive:
a) are divisible by 5 or 7? b) are divisible by 4 but not 6.

Question 21: How many bit strings of length 10 either begin with two 0s or end with four 1s.
Question 22: A person deposits $1000 in an account yields 10% interest compounded annually. How much
money will the account contain after 50 years?
Question 23: Suppose that f (n) = 2f (n/5) + n2 and f (1) = 2. Find f (125)?
Question 24: How many one-to-one functions are there from a set with 4 elements to a set with 8 elements.
Question 25: A young pair of rabbits (one of each sex) is placed on an island. A pair of rabbits does not breed
until they are 2 month old. After they are 2 month old they will produce 4 pairs of rabbits each month. Find
the number of pairs of rabbits after 5 months.

You might also like