Professional Documents
Culture Documents
1.4
1.4
Unit 1 – Tutorial 1
a. Input
b. Definiteness
c. Finiteness
d. All the above
Try This
2. ← operator used in algorithm for ____.
a. Assignment
b. Addition
c. Division
d. Multiplication
Try This
3. Programming constructs and assignment operators
are included in ____ section of an algorithm.
a. Comment
b. Head
c. Body
d. Input
2. Fundamentals of Algorithmic Problem Solving
Try This
4. Name the ways in specifying an algorithm?
a. Natural Language
b. C language
c. Flowchart
d. None of the above
Try This
5. ______is the first step in solving the problem
A. Understanding the Problem
B. Identify the Problem
C. Evaluate the Solution
D. None of these
a. Decision
b. Transition
c. Input and Output
d. Stop State
Try This
12. Factors for analyzing the algorithm are _____.
a. Time efficiency
b. Space efficiency
c. Declaration in an algorithm
d. None of the above
3. Important Problem types
(i). Sorting
(ii). Searching
(iii). Graph problems
Try This
13. The complexity of the sorting algorithm measures the …… as a
function of the number n of items to be sorter.
A. average time
B. running time
C. average-case complexity
D. case-complexity
a. Sorting
b. Searching
c. Shortest Path Algorithm
d. Graph Traversal
Try This
16. The worst-case occur in linear search algorithm
when …….
}
Order of Growth
Best-case, Average-case, Worst-case
Sequential Search
Best-case, Average-case, Worst-case
Sequential Search
Best Case
k = 7, n = 5 [7,8,9,1,2]
Comparison = 1 time
Cbest(n) = 1
Worst Case
k=2, n=5 [7,8,9,1,2]
Comparison = 5 times – n times
Cworst(n) = n
Best-case, Average-case, Worst-case
Sequential Search
Average Case
k = 7, n = 5 [1,2,3,7,8]
P (0<=P<=1)
Cavg(n) = [1.p/n+2.p/n+….+i.p/n+….+n.p/n] + n.(1-p)
=p/n [1+2+….+n]+n(1-p)
= p/n . N(n+1)/2 + n(1-p)
Success : p=1 n+1/2
Unsuccess : p=0 : n
Asymptotic Analysis
3. Asymptotic Notation
18. The time factor when determining the efficiency of algorithm is measured
by__
5. Counting the number of key operations
6. Counting the microseconds
7. Counting the number of statements
8. Counting the kilobytes of algorithm
Try This
19. In ___type of search the list is divided in to two parts.
1. Linear search
2. Binary search
3. random search
4. None
23. In linear search with array, how many comparisons are needed in worst
case?
5. 0
6. 1
7. n
8. n/2
8. Substitution Method – Backward (Iteration) Method
Substitution Method – Backward (Iteration) Method
Example 2
Try This
24. If a key is found in a list that is called ___ type of search
1. Unsuccessful
2. successful
3. partial success
4. partial unsuccessful
25. In linear search with array, how many comparisons are needed in best
case?
5. 0
6. 1
7. n
8. n/2
Recursion Tree Method
•1. Recursion Tree Method is a pictorial representation of an
iteration method which is in the form of a tree where at each
level nodes are expanded.
•2. In general, we consider the second term in recurrence as
root.
•3. It is useful when the divide & Conquer algorithm is used.
•4. Expand the children.
•5. Add up each level.
•6. Sum up the levels.
Example 1
Example 1
Try This
26. Searching techniques are classified in to__ types
1. 2
2. 3
3. 4
4. none
1. Linear search
2. Non linear search
3. Address calculation search
4. A and B
Thank You