Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Exam (elaborations)

UCCC 2063 Algorithm Analysis Midterm with answer (UTAR)

Rating
-
Sold
-
Pages
11
Grade
A+
Uploaded on
19-08-2024
Written in
2024/2025

UCCC 2063 Algorithm Analysis Midterm with answer (UTAR) True/False: Is 2^(n+1) = O(2^n) ? - ANSWERFalse 3^n + 12 - ANSWERO(2^n) What is the Asymptotic complexity of a binary search given the code below and the following recursion equation: T(n) = T(n/2) + 1 // initially called with low = 0, high = N - 1 BinarySearch_Right(A[0..N-1], value, low, high) { // invariants: value = A[i] for all i low value A[i] for all i high if (high low) return low mid = (low + high) / 2 if (A[mid] value) return BinarySearch_Right(A, value, low, mid-1) else return BinarySearch_Right(A, value, mid+1, high) } - ANSWERO(lg * n) Given the following algorithm, what is the number of fundamental instructions that this routine will execute if the value of n is 4? var M = A[ 0 ]; for ( var i = 0; i n; ++i ) { if ( A[ i ] = M ) { M = A[ i ]; } } - ANSWER4+2n True/False: A Boolean variable can take on only 1 value. - ANSWERFalse Which of the following is NOT a property of logarithms? a. log(nm) = log n + log m b. log(n/m) = log n - log m c. log (n^r)= r log n d. log(b) n= log(n)b log(a)b - ANSWERd True/False: An algorithm is a well-defined sequence of steps used to solve a well-defined problem in finite time. - ANSWERTrue True/False: The running time of an algorithm is the number of instructions it executes when run on a particular instance. - ANSWERTrue True/False: An algorithm is a well-defined sequence of steps used to solve a well-defined problem in an infinite number of steps. - ANSWERFalse True/False: The backtracking algorithm treats the solution space as a graph and follows a path to conclusion to find a solution to a problem. The algorithm may 'backtrack' by reversing up to previous branches in a tree and try all branches to find the solution. - ANSWERTrue The Backtracking algorithm implements what search? a. Depth First Search b. Sequential search c. Breadth First Search d. Binary Search - ANSWERa

Show more Read less
Institution
Course

Content preview

UCCC 2063 Algorithm Analysis Midterm
with answer (UTAR)



True/False: Is 2^(n+1) = O(2^n) ? - ANSWER>>False

3^n + 12 - ANSWER>>O(2^n)

What is the Asymptotic complexity of a binary search given the code below and
the following recursion equation:

T(n) = T(n/2) + 1

// initially called with low = 0, high = N - 1
BinarySearch_Right(A[0..N-1], value, low, high) {
// invariants: value >= A[i] for all i < low
value < A[i] for all i > high
if (high < low)
return low
mid = (low + high) / 2
if (A[mid] > value)
return BinarySearch_Right(A, value, low, mid-1)
else
return BinarySearch_Right(A, value, mid+1, high)
} - ANSWER>>O(lg * n)

Given the following algorithm, what is the number of fundamental instructions that
this routine will execute if the value of n is 4?

var M = A[ 0 ];
for ( var i = 0; i < n; ++i ) {
if ( A[ i ] >= M ) {

, M = A[ i ];
}
} - ANSWER>>4+2n

True/False: A Boolean variable can take on only 1 value. - ANSWER>>False

Which of the following is NOT a property of logarithms?

a. log(nm) = log n + log m
b. log(n/m) = log n - log m
c. log (n^r)= r log n
d. log(b) n= log(n)b log(a)b - ANSWER>>d

True/False: An algorithm is a well-defined sequence of steps used to solve a well-
defined problem in finite time. - ANSWER>>True

True/False: The running time of an algorithm is the number of instructions it
executes when run on a particular instance. - ANSWER>>True

True/False: An algorithm is a well-defined sequence of steps used to solve a well-
defined problem in an infinite number of steps. - ANSWER>>False

True/False: The backtracking algorithm treats the solution space as a graph and
follows a path to conclusion to find a solution to a problem. The algorithm may
'backtrack' by reversing up to previous branches in a tree and try all branches to
find the solution. - ANSWER>>True

The Backtracking algorithm implements what search?

a. Depth First Search
b. Sequential search
c. Breadth First Search
d. Binary Search - ANSWER>>a

Which of the following is NOT one of the steps used in a Divide-and-conquer
algorithm to solve a problem?

a. Breaking the problem into subproblems that are themselves smaller instances of
the same type of problem

Written for

Course

Document information

Uploaded on
August 19, 2024
Number of pages
11
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

$21.49
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
angelamakinyaa

Get to know the seller

Seller avatar
angelamakinyaa Chamberlain College Of Nursing
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
1 year
Number of followers
0
Documents
211
Last sold
-
exam questions with answer ,class notes

EXCELLENT HOMEWORK HELP AND TUTORING ,ALL KIND OF QUIZ AND EXAMS WITH GUARANTEE OF A Am an expert on major courses especially; psychology,Nursing, Human resource Management and Mathemtics Assisting students with quality work is my first priority. I ensure scholarly standards in my documents and that's why i'm one of the BEST GOLD RATED TUTORS in STUVIA. I assure a GOOD GRADE if you will use my work.

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions