CPE 202 study

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

Information hiding refers to separating the data storage/organization from the user.

True

Assuming a hash table with a size that is a prime number, in order to guarantee finding an open slot when using quadratic probing, the load factor (λ) must be less than:

0.5

An algorithm takes 300 milliseconds to process 300 items. Estimate how long (in milliseconds) it will take to process 100 items, if the algorithm is O(1)

300

Given the postfix expression " 12 6 / 5 + 7 * " what would be the state of the stack after reading and processing?

49

Recursion is always the most efficient approach for the implementation of an algorithm.

False

When using separate chaining for each index, the number of items that can be stored in a hash table is limited by the number of "slots or buckets" of the hash table.

False

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))

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

O(log(n))

Identify the Big-O time complexity for the stated operation. Perform Heap Sort on random set of data

O(n log(n))

Choose the Big O description that best describes adding n elements to a hash table as presented or implemented in this class, assuming a low load factor and efficient hash function.

O(n)

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

O(n)

Choose the Big O time complexity that provides the best description for the following operation's running time. Estimate for the worst case of finding the minimum key in a Binary Search Tree

O(n)

Choose the Big O time complexity that provides the best description for the following operation's running time. Search a linked list for an item (assume items are unordered)

O(n)

Choose the Big O time complexity that provides the best description for the following operation's running time. For a balanced BST with a Node definition that has key, item, left and right attributes: Searching the BST to determine if a certain item (not key) is in the BST

O(n)

Choose the Big O time complexity that provides the best description for the following operation's running time. Level order traversal of a binary tree. You can assume that individual enqueue/dequeue operations are O(1)

O(n)

Linked lists and binary trees can be viewed as a graphs.

True

An algorithm takes 100 milliseconds to process 300 items. Estimate how long (in milliseconds) it will take to process 900 items, if the algorithm is O(n^2)

900

A sequential (linear) search of an array for a specific item exhibits a Big O time complexity of O(n)

True

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

Queue

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

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

How many stacks are needed to implement a queue?

2

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

False

ADT that is often implemented using a binary heap:

Priority Queue

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

Stack

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

i // 2

An algorithm takes 200 ms to process 100 items. Estimate how many items the algorithm can process in 800 ms, if the algorithm is O(log(n))

100^4

An algorithm takes 300 ms to process 500 items. Estimate how many items the algorithm can process in 2700 ms, if the algorithm is O(n^2)

1500

Given two vertices in an undirected graph, c and f, which of the two traversals (BFS and DFS) can be used to find if there is path from c to f?

Both of them

100% test coverage as measured by the coverage utility means no more tests need to be written.

False

Choose the Big O time complexity that provides the best description for the following operation's running time. dequeue() in the circular array implementation of a Queue done in lab.

O(1)

Choose the Big O time complexity that provides the best description for the following operation's running time. enqueue() in the Node List implementation of a Queue done in lab. Recall the lab used two Node Lists - one for the "rear" of the Queue, and another for the "front" of the Queue.(n represents the number of items in the queue.)

O(1)

Identify the Big-O time complexity for the stated operation. Find (but do not remove/dequeue) the minimum key in a Min Binary Heap

O(1)

Identify the Big-O time complexity for the stated operation. Given a key, remove the key/value pair from a hash table (typical case, efficient hash table, low load factor)

O(1)

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

Merge sort

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))

Assuming a NodeList implementation of a Stack (as in Lab #2), the push operation time complexity is:

O(1)

Assuming a circular array implementation for a Queue as in Lab 3, the enqueue() operation is(index wraps around if end of array is met):

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. Delete the first (head) node from a doubly linked list, assuming a sentinel node implementation

O(1)

Choose the Big O time complexity that provides the best description for the following operation's running time. Pop an item from a stack, assuming a NodeList implementation as in Lab #2

O(1)

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))

Consider a full (all levels completely filled left to right) Binary Search Tree. The median key value is located:

Root

A set of course pre-requisite requirements can be represented as a directed acyclic graph

True

A stack is commonly used to keep track of function calls and program execution, pushing the current state of operations prior to a functional call, and popping from the stack in order to return to that state.

True

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

True

Given the following sequence of integers in an array, what would be the state of the array after the completion of the first three iterations (passes) of the main loop using Selection Sort (sorting in ascending order)? [21, 32, 16, 9, 28, 5, 13, 35, 49, 2]

[2, 5, 9, 16, 28, 32, 13, 35, 49, 21]

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

peek

Choose the Big O time complexity that provides the best description for the following operation's running time. Create a list by inserting "n" items, one at a time, at index 0 of a Python List (overall time complexity of creating the list of n items)

O(n^2)

Choose the Big O time complexity that provides the best description for the following operation's running time.Insertion sort on an unsorted random set of "n" integers

O(n^2)

Choose the Big O time complexity that provides the best description for the following operation's running time.Run Quick Sort on an unsorted array of random integers, using the first index as the pivot.Run Quick Sort again on the result from above, again using the first index as the pivot.

O(n^2)

Choose the Big O time complexity that provides the best description for the following operation's running time.Selection sort on an unsorted random set of "n" integers

O(n^2)

For the following, assume each individual pop operation is O(1), and the each individual queue operation is O(1) There are "n" items in a stack to be transferred to a queue. Pop all "n" items from a stack and enqueue them to a queue - overall time complexity for transferring all "n" items is:

O(n^2)

Choose the Big O time complexity that provides the best description for the following operation's running time.Perform Bubble sort on random set of data

O(n^2))

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

False

When making recursive function calls (or any sequence of function calls), a Queue is used to keep to track of the state of each function, allowing the execution flow to easily return to the previous calling function. You Answered True

False

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

O(log(n))

Which is the most appropriate definition for recursion?

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

Identify the Big-O time complexity for the stated operation. Given a key, retrieve the key/value pair in a hash table (typical case, efficient hash function, low load factor)

O(1)

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)

Choose the big O description that provides the tightest accurate running time bound to adding n elements to a hash table as presented or implemented in this class, assuming a low load factor and efficient hash function.

O(n)

Identify the Big-O time complexity for the stated operation. Breadth First Search of a graph. (where "n" is the total number of edges plus vertices)

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. Depth First Search of a graph. (where "n" is the total number of edges plus vertices)

O(n)

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

O(n)

Identify the Big-O time complexity for the stated operation. Resize a hash table (e.g. growing hash table as in Project 4, when load factor > .5)

O(n)


Set pelajaran terkait

Chapter 17: Pregnancy at Risk: Pregnancy-Related Complications Prep- U Maternal

View Set

Chapter 10: Competing Around the World

View Set

04 Center of the System/The Solar Wind 3

View Set

23 - Viral Causes of Skin lesions/rashes

View Set

Anemia and Coagulation Meds Nclex question

View Set

PEDS chapter 23, 24, 28, 30, & 33 EAQs

View Set

Pathoma- Chapter 15: Adrenal Cortex and Adrenal Medulla

View Set