CSE374 - Quiz Questions

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

asymptotic lower bound

"Big-omega" provides the a. asymptotic tight bound b. asymptotic lower bound c. asymptotic upper bound d. No answer text provided.

cut

A ________________ of a connected graph is a minimal set of edges whose removal separate the graph into two components. a. cut b. light edge c. min set

a root node,left subtree , right subtree

A binary tree is composed of three disjoint sets of nodes : a. a root node,left subtree , right subtree b. left subtree, right subtree, bottom subtree

Only 2

A graph algorithm with Θ (E log V ) running time is asymptotically better than an algorithm with a Θ (E log E) running time for a connected, undirected graph G(V, E). 1. The above statement is TRUE because in a connected graph E ≤ V2/ 2 2. The above statement is FALSE because in a connected graph E ≤ V2/ 2 2. The above statement is TRUE because in a connected graph E ≥ V2/ 2 4. The above statement is FALSE because in a connected graph E ≥ V2/ 2 a. Only 1 b. Only 4 c. None of the Choices d. Only 2

True (greedy)

A greedy algorithm always makes a locally optimal choice in the hope that this choice will lead to a globally optimal solution. a. True b. False

True (heap)

A heap can be constructed from an unordered array of numbers in linear worst-case time. a. True b. False

theta (n^2)

On an input array of n numbers ,the quicksort algorithm has a worst-case running time of a. theta (log n) b. theta (n^3) c. theta (n^2) d. theta (n)

О(n^2)

The Average case complexity of Insertion sort is: a. О(n^2) b. O(n) c. О(n^3) d. O(log n)

a ≥ 1 and b > 1

The Master Theorem applies to recurrences of the following form:T (n) = aT (n/b) + f(n) In what form should the constants a and b be? a. a ≥ 0 and b > 1 b. a ≥ 1 and b > 0 c. a ≥ 1 and b > 1 d. a ≥ 0 and b > 0

V - S

We say that an edge (u,v) ∈ E crosses the cut (S, V - S ) if one of its endpoints is in S and the otheris in a. S b. V + S c. E d. V - S

f (n)=theta( g(n) )

We say that g(n) is an asymptotically tight bound for f (n), if a. f (n)=O( g(n) ) b. f (n)=theta( g(n) ) c. f (n)=omega( g(n) ) d. No answer text provided.

15,20,10,18 -- 10,15,20,18 -- 10,15,18,20 -- 10,15,18,20

What are the correct intermediate steps of the following data set when it is being sorted with the Insertion sort? 15,20,10,18 a. 15,20,10,18 -- 10,15,20,18 -- 10,15,18,20 -- 10,15,18,20 b. 10, 20,15,18 -- 10,15,20,18 -- 10,15,18,20 c. 15,18,10,20 -- 10,18,15,20 -- 10,15,18,20 -- 10,15,18,20 d. 15,10,20,18 -- 15,10,18,20 -- 10,15,18,20

10, 20,15,18 -- 10,18,15,20 -- 10,15,18,20

What are the correct intermediate steps of the following data set when it is being sorted with the Quick sort? 15,20,10,18 a. 10, 20,15,18 -- 10,15,20,18 -- 10,15,18,20 b. 15,10,20,18 -- 15,10,18,20 -- 10,15,18,20 c. 15,20,10,18 -- 15,10,20,18 -- 10,15,20,18 d. 10, 20,15,18 -- 10,18,15,20 -- 10,15,18,20

Sunday 11:59 PM EST

What are the due dates for all the weekly assignments in general? a. Friday 11:59 PM EST b. Sunday 11:59 PM EST c. Not specified in syllabus d. Monday 11:59 PM EST

Random Access Machine

What does RAM stand for? a. Random Access Memory b. Random Access Machine c. Real Action Mark-up d. Rapid Access Movement

zero on the assignment followed by a reduction of a full letter grade in the course

What happens if a student is found to have plagiarized for an assignment? a. zero on the assignment followed by a reduction of a half-letter grade in the course b. Drop the student from class c. zero on the assignment followed by a reduction of a full letter grade in the course

Non Overlapping sub problems

What is NOT the property of a Greedy Algorithm: a. Non Overlapping sub problems b. Greedy Choice c. Overlapping sub problems d. Optimal Substructure

When each sublist has one element

A mergesort works by first breaking a sequence in half a number of times so it is working with smaller pieces. When does it stop breaking the list into sublists? a. When each sublist has one element b. When each sublist has two elements c. After four splits d. It's not the size that counts, it's how you use it!

True (recursionTree)

A recursion tree is best used to generate a good guess, which you can then verify by the substitution method. a. True b. False

False, spanning tree algorithms do not work on undirected graphs.

A spanning tree of a given undirected, connected graph G = (V, E) can be found in O(E) time. a. False, spanning tree algorithms need at least O(V^2) time using array implementation and O(ElgV) time using Binary Heap implementation. b. No answer text provided. c. False, spanning tree algorithms do not work on undirected graphs. d. The statement is True.

typed clearly and submitted electronically, handwritten legibly and submitted using a high-quality scanner

All Homework assignments must be a. handwritten and then phtographed and converted to PDF b. typed clearly and submitted electronically c. handwritten legibly and submitted using a high-quality scanner

open addressing

An alternative method for resolving collisions, is called a. chaining b. non-collision c. open addressing

O(n*log n)

An array consists of n elements. We want to create a heap using the elements. The time complexity of building a heap will be in the order of a. O(n*n*log n) b. O(n*log n) c. O(n *log n *log n) d. O(n*n)

minimum of any edge satisfying the property

An edge is a light edge satisfying a given property if its weight is the a. maximum of any edge satisfying the property b. subtraction of any edge satisfying the property c. addition of any edge satisfying the property d. minimum of any edge satisfying the property

Graph G has multiple distinct MSTs, each of cost n-1

An undirected graph G has n nodes. Its adjacency matrix is given by an n × n square matrix whose (i) diagonal elements are 0's and (ii) non-diagonal elements are 1's. which one of the following is TRUE? a. Graph G has multiple distinct MSTs, each of cost n-1 b. Graph G has no minimum spanning tree (MST) c. Graph G has a unique MST of cost n-1 d. Graph G has multiple spanning trees of different costs

False (masterTheorem)

By the master theorem, the solution to the recurrence T(n) = 3T(n/3) + log n is T(n) = Θ(n log n). a. True b. False

No

Can you solve the following recurrence using Master's Theorem: T(n)=2T(n/2)+n/log(n) ? a. Yes b. No

Java

Coding assignments must use a. C++ b. Python c. Java d. Any choice of programming language

10

Consider a complete undirected graph with vertex set {0, 1, 2, 3, 4}. Entry Wij in the matrix W below is the weight of the edge {i, j}. What is the minimum possible weight of a spanning tree T in this graph such that vertex 0 is a leaf node in the tree T? a. 8 b. 7 c. 9 d. 10

6 comparisons, 5 swaps

Consider the following lists of partially sorted numbers. The double bars represent the sort marker. How many comparisons and swaps are needed to sort the next number. [1 3 4 5 8 9 || 2] a. 5 comparisons, 4 swaps b. 4 comparisons, 5 swaps c. 6 comparisons, 5 swaps d. 5 comparisons, 6 swaps

Θ(n^2)

Consider the recurrence T(n) = 4T(n/2) + n Use masters method to solve T(n) a. Θ(2) b. Θ(n) c. Θ(n^n) d. Θ(n^2)

T (n)= O(n lg n)

Consider the recurrence: T (n)= 2T ((n/2) + 17) + n Make a good guess of the solution. a. T (n)= O(n lg n) T (n)= O(n ^ n) T (n)= O(n ) T (n)= O( lg n)

A = A U {(u,v)}

Correct the algorithm if there is any error: GENERIC-MST(G, w) 1. A = Φ 2. while A does not form a spanning tree 3. find an edge (u,v) that is safe for A 4. A = A ∩ {(u,v)} 5. return A a. while A forms a spanning tree b. return {(u,v)} c. A=G d. A = A U {(u,v)}

MERGE-SORT (A, p, q)

Correct the errors if any from the below algorithm: MERGE-SORT (A, p, r) if p < r q = (p +r)/ 2 MERGE-SORT (A, p+1, q-1) MERGE-SORT (A, q+ 1, r) MERGE (A, p, q, r) a. if p > r b. q = (p +r)/ 4 c. MERGE-SORT (A, p, q) d. There are no errors

delaying any 2 assignments of type HW or coding assignment up to a week

Delay Policy for the course allows a. no delay in assignment submission after the first 2 delayed ones b. up to 1 day delay in assignment submission after the first 2 delayed ones with 50% penalty c. up to 1 day delay in assignment submission after the first 2 delayed ones without any penalty Correct! d. delaying any 2 assignments of type HW or coding assignment up to a week

theta (n lg n) (quicksort)

Despite this slow worst-case running time, quicksort is often the best practical choice for sorting because it is remarkably efficient on the average: its expected running time is a. theta (n^2) b. theta (n ) c. theta (lg n) d. theta (n lg n)

True (binary tree)

Does heap exhibit the property of a binary tree? a. False b. True

n^2log_2(n)

Find the dominant term for determining the complexity of n^2log_2(n) + n(log_2(n))^2: a. n^2log_2(n) b. n^2 c. log_2(n^2) d. log_2(n)

"little-omega of g of n"

For a given function g(n), what does the below function represent? {f (n) : for any positive constant c > 0, there exists a constant n0 > 0 such that 0 <=cg(n) < f (n) for all n >= n0 } a. "little-omega of g of n" b. "little-theta of g of n" c. "little-oh of g of n"

theta(g(n))

For a given function g(n), what does the below function represent? {f (n) : there exist positive constants c1, c2, and n0 such that 0 <= c1g(n) <= f (n) <= c2g(n) for all n >= n0} a. O(g(n)) b. theta(g(n)) c. omega(g(n)) d. No answer text provided.

True (omega)

For any two functions f (n) and g(n), we have f (n) = theta(g(n) ) if and only if f(n) = O(g(n)) and f(n)= omega(g(n)). a. True b. False

True (minimum cost edge)

Given a graph G = (V, E) with cost on edges and a set S ⊆V , let (u, v) be an edge such that (u, v) is the minimum cost edge between any vertex in S and any vertex in V - S. Then, the minimum spanning tree of G must include the edge (u, v). (You may assume the costs on all edges are distinct, if needed.) a. True b. False

the average number of elements stored in a chain

Given a hash table T with m slots that stores n elements, we define the load factor as a. the sum of elements stored in a chain b. the average number of elements stored in a chain c. the number of elements stored in a chain

<2,4,5,6,1,3>

Given an array, A = <5, 2,4, 6,1, 3>, what is the sequence of elements after the third step, if INSERTION-SORT is applied on it? a. <2,4,5,6,1,3> b. <1,2,3,4,5,6> c. <5,2,4,6,1,3> d. <1,2,5,6,3,4>

i and ii only

Given the following input (4322, 1334, 1471, 9679, 1989, 6171, 6173, 4199) and the hash function K mod 10, which of the following statements are true? i. 9679, 1989, 4199 hash to the same value ii. 1471, 6171 has to the same value iii. All elements hash to the same value iv. Each element hashes to a different value a. ii only b. iii or iv c. i and ii only d. i only

Priority queue

Heap can be used as a. Stack b. None of the mentioned c. Priority queue d. Array

theta (1+ α)

In a hash table in which collisions are resolved by chaining, an unsuccessful search takes average-case time a. theta ( α) b. No answer text provided. c. O (1+ α) d. theta (1+ α)

1, 0

In a hash table of size 13 which index positions would the following two keys map to? 27, 130 a. 13, 0 b. 1, 10 c. 1, 0 d. 2, 3

True (max-heap)

In a max-heap, the max-heap property is that for every node i other than the root,A[PARENT(i )] >= [A] . a. True b. False

True (undirected graph)

In an undirected graph G =(V, E ), the edge set E consists of unorderedpairs of vertices. a. True b. False

False (undirected graph)

In an undirected graph, self-loops are possible. a. False b. True

the size of its input

In general, the time taken by an algorithm grows with the size of the input, so it is traditional to describe the running time of a program as a function of a. the size of its input b. the lines of algorithm c. the actual time recorded d. the number of inputs to the algorithm

n > 30

In practice, merge sort beats insertion sort for a. n>10 b. n>15 c. n>20 d. n > 30

hashing by division and hashing by multiplication

In regards to the design of good hash functions, two of the schemes which are heuristic in nature are a. hashing by division and hashing by multiplication b. No answer text provided c. hashing by division and hashing by addition d. hashing by division and hashing by subtraction

O(1)

In simple uniform hashing, what is the search complexity? a. O(n) b. O(logn) c. O(nlogn) d. O(1)

True (merge sort)

In the worst case, merge sort runs in O(n2) time. a. True b. False

20

In this sequence, 11 4 20 45 32 60 98 70, which element seems to be the pivot? a. 70 b. 20 c. 4 d. 98

in place

Insertion Sort works __________________ . a. in place b. out of place

True (n^2 bigO)

Is n^2 = O(n^3 + n^4) ? [O==Big Oh] a. True b. False

Yes, 50% deduction if submitted within 24 hours past the deadline

Is there a delay policy for this class? a. Yes, 50% deduction if submitted within 24 hours past the deadline b. Yes, 25% deduction if submitted within 24 hours past the deadline c. No delay allowed.

False (weight graph)

Let G = (V, E) be a weighted graph and let M be a minimum spanning tree of G . The path in M between any pair of vertices v1 and v2 must be a shortest path in G a. False b. True c. True but only in certain cases and not in all cases. d. Irrelevent. Since, MST and SP algorithms operate separately

No minimum spanning tree contains emax

Let G be an undirected connected graph with distinct edge weight. Let emax be the edge with maximum weight and emin the edge with minimum weight. Which of the following statements is false? a. If emax is in a minimum spanning tree, then its removal must disconnect G b. No minimum spanning tree contains emax c. G has a unique minimum spanning tree d. Every minimum spanning tree of G must contain emin

True (heapsort sorting)

Like insertion sort, heapsort sorts in place: only a constant number of array elements are stored outside the input array at any time. a. True b. False

primary clustering

Linear probing is easy to implement, but it suffers from a problem known as a. Fill up b. Overflowing c. primary clustering d. secondary clustering

weighted, connected, undirected

MST Algorithms works on which of the following type(s) of graph: a. weighted,connected,directed b. weighted,disconnected, undirected c. weighted,disconnected, directed d. weighted ,connected, undirected

True (mergeSort)

Merge sort algorithm cannot be performed in-place, it needs scratch-space apart from the array being sorted. a. True b. False

No Error

One of the cases of Master theorem is given below: If f (n)= O(n (logb a-e) ) for some constant e > 0, then T (n)= theta(nlogb a). Fix the error if any. a. No Error b. T (n)= omega (n logb a) c. T (n)= O (n logb a) d. T (n)= theta (logb a)

chaining

One of the simplest collision resolution technique is called a. non-collision b. chaining c. collision resolution

False (prims)

Prim's algorithm executed on a planar graph will perform best when the priority queue is implemented using an array. a. True b. False

Partitioning

Quick sort uses a. Selection b. Merging c. Partitioning d. Exchanging

divide-and-conquer paradigm

Quick sort, like merge sort, applies the a. Iterative paradigm b. Greedy paradigm c. divide-and-conquer paradigm d. Recursion paradigm

f2 ,f4, f3, f1

Rank the following functions by increasing order of growth; that is, find an arrangement g1, g2, g3, g4 of the functions satisfying: g1 = O(g2), g2 = O(g3), g3 = O(g4). f1 = n^(logn) f2 = sqrt(n) f3 = n^(3+sin(n)) f4 = log n^n a. f2 ,f1, f3, f4 b. f2 ,f4, f3, f1 c. f2 ,f4, f1, f3 d. f1 ,f4, f3, f2

54,lg n ,4n , 6n^3,8^(2n)

Rank these functions according to their growth, from slowest growing (on the left) to fastest growing (on the right) 4n, lg n, 8^(2n), 54, 6n^3 a. lg n ,4n ,8^(2n), 6n^3,54 b. 54,lg n ,4n ,8^(2n), 6n^3, c. 54,lg n ,4n , 6n^3,8^(2n) d. 54,lg n ,4n , 6n^3,

All of the mentioned

Select all that is true: A hash function should have which properties? a. Uniform distribution. b. Speedy computation. c. The range is a subset of the integers. d. Equivalent objects produce equal hash codes. 0. All of the mentioned

Linear probing, Quadratic probing

Select all the open addressing approaches to hash table collisions: a. Linear probing. b. Quadratic probing. c. Exponential hashing. d. Separate chaining.

False

State TRUE or FALSE: Rule of sums: O(f + g) = O(f) + O(g) a. True b. False

2

Suppose we are sorting an array of eight integers using heapsort, and we have just finished some heapify (either maxheapify or minheapify) operations. The array now looks like this: 16 14 15 10 12 27 28 How many heapify operations have been performed on the root of the heap? a. 2 b. 1 c. 5 or 6 d. 3 or 4

All are correct

The RAM model operates by the following principles: 1. Basic logical or arithmetic operations (+, *, =, if, call) are considered to be simple operations that take one time step. 2. Loops and subroutines are complex operations composed of multiple time steps. 3. All memory access takes exactly one time step. How many of the above statements are correct? a. None are correct b. 1 & 2 are correct c. All are correct d. 2 & 3 are correct

Sat 3-4 PM EST, Sun 3-4 PM EST

The TA help session for the course is during WF 10-11 AM EST Sat 3-4 PM EST MWF 8-9 PM EST Sun 3-4 PM EST

True

The data types in the RAM model are integer and floating point (for storing real numbers). a. True b. False

False (maxheap array)

The following array is a max heap: [10, 3, 5, 1, 4, 2]. a. True b. False

No, QUICKSORT(A, q +1, r)

The following procedure implements quicksort:QUICKSORT (A, p, r) 1 if p < r 2 q = PARTITION(A, p, r) 3 QUICKSORT(A, p, q - 1) 4 QUICKSORT(A, q -1, r) Will the algorithm work as expected? Fix the mistake(s) if any. a. No, No need to partition b. Yes , Runs absolutely fine c. No, QUICKSORT(A, q +1, r) d. No, QUICKSORT (A, p +1, q-1)

"theta of n-squared"

The insertion sort has a worst-case running time of a. "theta of n-cubed" b. "theta of log n " c. "theta of n" d. "theta of n-squared"

W 9-10 AM EST, R 7-8 PM EST

The instructor office hours for the course is during a. W 9-10 AM EST b. T 9-10 AM, W 9-10 AM EST c. R 7-8 PM EST d. TR 8-9 PM EST

theta (n lg n)

The merge sort has a time complexity of a. theta (n lg n) b. theta (n) c. theta (lg n) d. theta (n^2 lg n)

False (MasterMethod)

The recurrence relation T(n) = 4T(n/2) + n2 /lg n can be best solved using Master Method a. True b. False

primitive operations or "steps" executed

The running time of an algorithm on a particular input is the number of a. No answer text provided. b. primitive operations or "steps" executed c. lines in the algorithm d. No answer text provided.

O(1) (hash value)

The time required to compute the hash value h(k) is a. O(n) b. O(lg n ) c. O(1)

True (MST)

The two algorithms for solving the minimum spanning-tree problem are Kruskal's algorithm and Prim's algorithm. a. True b. False

gives us an upper bound on the running time for any input

The worst-case running time of an algorithm a. is often very bad compared to "average case" b. does not occur often c. gives us an lower bound on the running time for any input d. gives us an upper bound on the running time for any input

2n − 2

There are n people, each in possession of a different rumour. They want to share the news with each other by sending electronic messages. What is the minimum number of messages they need to send to guarantee that every one of them gets all the rumours? a. 2n − 2 b. 2n + 2 c. 2n − 4 d. n − 2

A d-max-heap is like an ordinary binary max-heap, except that nodes have d children instead of 2.

What is a d-max-heap? a. A d-max-heap is like an ordinary binary max-heap, except that nodes have d children instead of 2. b. A d-max-heap is like an ordinary binary max-heap, with depth d. c. A d-max-heap is an ordinary binary max-heap, which requires O(d) time for its max-heapification.

A function that computes the location of the key in the array

What is a hash function? a. A function has allocated memory to keys b. A function that computes the location of the key in the array c. A function that creates an array d. None of the mentioned

The number of edges incident on it

What is meant by a degree of a vertex in an undirected graph? a. The number of neighboring vertex b. The number of edges incident on it

Divide-and-conquer

What is the below approach known as : Break the problem into several subproblems that are similar to the original problem but smaller in size, solve the subproblems recursively and then combine these solutions to create a solution to the original problem a. Divide-and-conquer b. Iterative c. Randomization d. Recursive

8

What is the hash key value of 'Donaldson' if you assign each letter its corresponding number in the alphabet (ie f = 6) and if you use 9 as the divisor? a. 8 b. 7 c. 12 d. 3

Random-access machine model

What is the model of the implementation technology for analyzing an algorithm? a. Big O notation model b. Big-theta notation c. Random-access machine model d. Random-accept machine model

O( n lg n)

What is the running time of heapsort? a. O( n lg n) b. O(n) c. O(lg n) d. O(n^2 )

True (adjacency relation)

When the graph is undirected, the adjacency relation is symmetric. a. True b. False

big-oh notation

When we have only an asymptotic upper bound, we use a. omega notation b. big-oh notation c. No answer text provided. d. theta notation

Case 2

Which Master's Theorem case does it belong to: T(n)=2T(n/2) + n log n a. Case 2 b. Case 1 c. Case 3 d. None of the above

Case 3

Which Master's Theorem case does it belong to: T(n)=7T(n/2) + n^3 a. Case 2 b. Case 3 c. Case 1

Case1

Which Master's Theorem case does it belong: T(n)=16T(n/4) + n a. Case1 b. None of the above c. Case3 d. Case2

Merge sort

Which algorithm closely follows the divide-and-conquer paradigm? a. Quick sort b. Merge sort c. Bubble sort d. Insertion sort

Insertion sort

Which algorithm would work best to sort data as it arrives, one piece at a time, perhaps from a network? a. Insertion sort b. Merge sort

Insertion sort (sorted algo)

Which of the following sorting algorithms for a typical implementation gives the best performance when applied on an array which is sorted or almost sorted? a. Merge sort b. Heap sort c. Insertion sort d. Quick sort

I and III only

Which of the following statement(s) is TRUE? 1. A hash function takes a message of arbitrary length and generates a fixed length code. 2. A hash function takes a message of fixed length and generates a code of variable length. 3. A hash function may give the same hash value for distinct messages. a. I only b. I and III only c. II only d. II and III only

Both P and Q

Which of the following statements is/are TRUE for undirected graphs? P: Number of odd degree vertices is even. Q: Sum of degrees of all vertices is even. a. P only b. Neither P nor Q c. Both P and Q d. Q only

All of the mentioned (priority queue)

With what data structure can a priority queue be implemented? a. All of the mentioned b. List c. Array d. Heap


Kaugnay na mga set ng pag-aaral

Colorado Property and Casualty Insurance

View Set

Geometry: Quiz 2: Similarity; Triangle Theorems

View Set

NSG 312 Exam 2 Lippincott: Assessment of Pregnancy

View Set

Great Diseases of The World Final Exam Review

View Set

Acid base balance Exemplar 1.B Metabolic Alkalosis

View Set