CSCI 3102 Final Review

¡Supera tus tareas y exámenes ahora con Quizwiz!

Consider the following graph. What is the minimum cost to travel from node (a) to node (b)? (chart sideways house)

-1

What is the least time in which we can raise a number x to power n

O(lgn)

What is the time complexity of the binary search algorithm ?

O(lgn)

Linear search has a worst-case complexity of

O(n)

What is the average time complexity requirement of counting sort?

O(n+k) where k is the range of the input

Use a recursion tree to determine a good asymptotic upper bound on the recurrence T(n) = T(n/2) + n^2

O(n^2)

What is the worst case time complexity of a quick sort algorithm?

O(n^2)

What is the best-case time complexity of the radix sort algorithm?

O(nk)

Identify the best-case time complexity of merge sort:

O(nlgn)

What is the average running time of a heap sort algorithm?

O(nlgn)

Which of the following is a correct time complexity to solve the 0/1 knapsack problem where n and w represents the number of items and capacity of knapsack respectively?

O(nw)

Which of the following algorithms takes nonlinear time for sorting?

Quick sort

Consider an array of positive integers between 123456 and 876543, which sorting algorithm can be used to sort these numbers in linear time?

Radix Sort

What is the basic principle behind Bellman-Ford Algorithm?

Relaxation

Bellman-Ford algorithm provides solution for ____________ problems.

Single source shortest path

What is the sum of lengths of all adjacency lists in directed graph?

Size of (Edges)

The main problem of the direct addressing is its:

Space complexity

Which of the following is the recurrence for Binary Search?

T(n)=T(n2)+Θ(1)

If there is a reachable negative-weight cycle from the source node, then

The shortest-path weight is not properly defined

How many steps does divide and conquer techniques need?

Three steps which are Divide, Conquer, and Combine.

Why do we need to mark the deleted slot with a sentinel value DELETED?

To continue searching if it appears in our path

Binary search is used only for searching in a sorted array.

True

Heap sort has O(nlgn)O(nlgn) average case time complexity.

True

Heap sort is a comparison-based sorting algorithm.

True

Heap sort is an in-place algorithm.

True

Quick sort follows Divide-and-Conquer strategy.

True

Quick sort is considered an in-place algorithm

True

When dynamic programming is applied to a problem, it takes far less time as compared to other methods that don't take advantage of overlapping subproblems.

True

How many sub-arrays does the quick sort algorithm divide the entire array into?

Two

Consider the following graph. How many minimum spanning tree, starting from node (a)? (chart with square and line going through middle)

Two minimum spanning trees with the same weight

Consider the following graph. What is the shortest path from (a) to (b)? (chart hexagon)

Undefined

The adjacency-matrix mush be symmetric in the case of

Undirected graph

Given an ordinary hash function h(k), Which one of the following represent the linear probing?

h(k,i)= [h(k)+i] mod m

How many multiplication in the original square matrix multiplications of size n?

n^3

What is the number of edges in a minimum spanning tree for a graph consists of V vertices?

|V|−1

What is the memory storage required for the adjacency-list?

Θ(V+E)

What is the total running time of Depth-first search for a graph?

Θ(V+E)

What is the memory storage required for the adjacency-matrix?

Θ(V^2)

Use the master method to give tight asymptotic bounds for the following recurrence. T(n) = 16T(n/4) + n^2

θ(n^2logn)

Which of the following is the most suitable definition of radix sort?

It is a non-comparison-based integer sort

Which of the following problems should be solved using dynamic programming?

Matrix Chain Multiplication

Which is the worst method of choosing a pivot element?

Maximum element as pivot

In dynamic programming, the technique of storing the previously calculated values is called

Memoaization

Shortest paths can contain

No cycle at all

What is the best time Complexity of the binary search algorithm ?

O(1)

What is the complexity of the hash table insertion when direct addressing is used?

O(1)

he running time for Dijkstra's algorithm is

O(ElogV)

What is the total running time of Breadth-first search for a graph?

O(V+E)

The running time for Bellman-Ford algorithm is

O(VE)

Heap sort is a stable sort.

False

Merge sort is considered a in-place algorithm

False

The time complexity of binary search is O(nlogn)

False

Undirected graph can have self-loops (edge from a vertex to itself)

False

Dijkstra's Algorithm is the prime example for

Greedy algorithm

Floyd-Warshall algorithm is an example for

Dynamic programming

A greedy algorithm can be used to solve all the dynamic programming problems.

False

Direct addressing works better when we have large number of keys.

False

How many comparisons will be made to sort the array A={1,5,3,8,2} using counting sort?

0

Consider the two matrices P and Q which are 10 x 20 and 20 x 30 matrices respectively. What is the number of multiplications required to multiply the two matrices?

10*20*30

Consider the following graph. What is the minimum cost to travel from node (a) to node (c)? (chart sideways house)

2

Consider the following graph. What is the minimum cost to travel from node (a) to node (e)? (chart sideways house)

2

What is the sum of lengths of all adjacency lists in undirected graph?

2*Size of (Edges)

Consider the following graph. What is the weight of the minimum spanning tree using Prim's algorithm, starting from node (a)? (chart with square and line going through middle)

27

Consider the weights and values of items listed below. Note that there is only one unit of each item. Item numberWeightValue 1 10 60 2 7 28 3 4 20 4 2 24 The task is to pick a subset of these items such that their total weight is no more than 11 Kgs and their total value is maximized. Moreover, no item may be split. What is the total value for the picked item if we used a greedy algorithm?

44

Consider the following graph. What is the shortest path from (a) to (e)? (chart hexagon)

5

Consider the weights and values of items listed below. Note that there is only one unit of each item. Item numberWeightValue 1 10 60 2 7 28 3 4 20 4 2 24 The task is to pick a subset of these items such that their total weight is no more than 11 Kgs and their total value is maximized. Moreover, no item may be split. What is the optimal total value for the picked item?

60

Consider the following heap after build heap phase. What will be its corresponding array? (chart with 97 at top)

97,53,59,26,41,58,31

If there is no cycles in a graph, this graph is called

Acyclic graph

Which of the following methods can be used to solve the matrix chain multiplication problem?

All of them

Which of the following algorithms can detect the negative-weight cycle?

Bellman-Ford algorithm

Why shortest paths cannot contain positive-weight cycle?

By removing the cycle we can get shorter path

When more than one key maps to the same array index in a hash table, this called:

Collision

If there is an edge between each pair of a graph vertices, this graph called

Complete graph

The steps (s) in the divide and conquer process that takes a recursive approach is:

Conquer

The asymptotic notation O(1)O(1) defines the complexity of type

Constant

What is the disadvantage of counting sort?

Counting sort cannot be used for array with non-integer elements

An example of hash tables data structure in Python are:

Dictionaries

Breaking the problem into smaller sub-problems in the divide and conquer process is the responsibility of:

Divide

Which of the following algorithm design techniques is used in the merge sort algorithm?

Divide and Conquer algorithm


Conjuntos de estudio relacionados

4-D: Surety and Fidelity Coverage

View Set

Unit 4 Critical Thinking Questions

View Set

Test Guide: Postwar America 1950s

View Set