csc quiz

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

The dictionary in Python is implemented using a hash table.

True

Choose the Big O time complexity description for removing an element at the beginning of a Python List (array) as presented or implemented in this class.

O(n)

Choose the Big O time complexity description for inserting an element in the middle of a Python list (array) as presented or implemented in this class:

O(n)

For a hash table of size 11, the following is a valid hash function: hash(key) = ((key % 11) // 11) + 3

True

Assuming a NodeList implementation of a Queue (as in Lab #3), the enqueue operation time complexity is:

O(1)

Consider a full Binary Search Tree. The median key value is located:

At the root of the BST

Identify the Big-O time complexity for the stated operation. Remove (dequeue) the maximum key from a Maximum Binary Heap

O(log n)

Select the ADT that is often implemented using a binary heap:

Priority Queue

An algorithm takes 20 ms to process a set of input data consisting of 300 items. Compute an estimate of how long it would take the algorithm to process 3,000 items if the algorithm is O(n2)? Assume that there are no lower-order terms, such as linear or constant terms and the algorithm's performance is directly proportional to n2

2000 ms

The load factor in a hash table with separate chaining must be:

no limit

def sum_list(py_list): # py_list is Python List of length n x = 0 for i in range(len(py_list)): x += py_list.pop(0) return x

O(n^2)

Choose the Big O time complexity that provides the best description for the following operation's running time.Find a key in a well-balanced Binary Search Tree

O(log n)

Linear Probing general load factor limit

lambda < 0.6

How many stacks are needed to implement a queue? (Hint: Think about the Lab 3 Queue NodeList implementation)

2

Which postfix expression represents the infix expression ( 6 / 3 ) − 2 * 4 + 1 using the usual rules for order of evaluation of arithmetic operations.?

6 3 / 2 4 * − 1 +

Which is the most appropriate definition for recursion?

A function that calls another execution instance of the same function.

If we do not specify a return value for a Python function, an exception is raised.

False

In Python, when we assign a reference to equal another reference, for example: loc2 = loc1 a copy of the object is created.

False

For a hash table of size 11, if using double hashing, the following is a suitable second hash function to determine the step for finding an empty slot:

False (needs +1)

Which of the following sorting algorithms requires additional memory, equivalent to the size of the array that is to be sorted?

Merge Sort

To dequeue an item from a queue (do not assume an implementation), the Big O time complexity is:

Not enough information to kno

Assuming a circular array implementation for a Queue as in Lab 3, the dequeue() operation is:

O(1)

Choose the Big O time complexity description for appending an element at the end of a Python List (array) as presented or implemented in this class.

O(1)

Choose the Big O time complexity that provides the best description for the following operation's running time.Best general case achievable time complexity for a comparison based sorting algorithm, starting with a random and unordered set of "n" integers

O(n log n)

Choose the big O description that provides the tightest accurate running time bound for dequeueing n items from a binary heap (average case) as presented or implemented in this class

O(n log n)

Identify the Big-O time complexity for the stated operation. Build a Binary Heap by repeated insertion (enqueue) of keys

O(n log n)

Choose the Big O time complexity that provides the best description for the following operation's running time.Search for a specific data item in a well-balanced Binary Search Tree without knowing the associated key.(Recall the key is used to place the Node in the BST, while the data is the "payload" that rides along)

O(n)

Identify the Big-O time complexity for the stated operation. Build a Binary Heap using the Bottom Up method

O(n)

Identify the Big-O time complexity for the stated operation. Find the minimum key in a Max Binary Heap

O(n)

You are given an unsorted set of integers in an array, and must determine the largest value in the set. From a time complexity standpoint, which of t

Perform a linear search on the array for the maximum value

Which ADT is used for a Breadth First Search of a graph?

Queue

Which ADT is used for a Depth First Search of a graph?

Stack

Big O analysis is concerned with the behavior of algorithms as the size of the input, n, grows and gets very large.

True

Select the answer that represents the state of mylist after the following code executes: def add_to_list(list,x): list.append(x) mylist = [] add_to_list(mylist,10) add_to_list(mylist,20)

[10, 20]

In a binary heap, what is the location of a parent node for any arbitrary node located at index i ?

i // 2

assuming table size is prime, load factor to guarantee an open spot

lamda < 0.5

For Merge Sort, if we have two arrays, each of size n/2 (assume n is even), what is the fewest number of comparisons that could be made during the merge operation (in terms of n)?

n / 2

For Merge Sort, if we have two arrays, each of size n/2 (assume n is even), what is the greatest number of comparisons that could be made during the merge operation (in terms of n)?

n = 1

What method/operation is used to view (but not remove) the top item on a stack?

peek


Set pelajaran terkait

Bab 5 Integrasi Nasional dalam Bingkai Bhinneka Tunggal Ika

View Set

Real Estate Brokerage CE Test #5

View Set

Activités par tous les temps- Ch 8

View Set

Chapter 10: Flow of Genetic Information

View Set

Medical Assistant Physical Exam Positions

View Set

Business Strategy 495 - Practice Exam Questions

View Set

Ch. 23 - Microbial Diseases of the Digestive System

View Set