205 do do die

Ace your homework & exams now with Quizwiz!

returns the item at the top of the stack, but does not remove it

The stack peek operation ________.

Identify the correct sequence of performing a binary search.

1. Binary search first checks the middle element of the list. 2. If the search key is not found, the algorithm: i. checks the left sublist if the search key is less than the middle element or ii. checks the right sublist if the search key is greater than the middle element.

graph, vertex, edge

A ____ is a data structure for representing connections among items, and consists of vertices connected by edges. A _______represents an item in a graph. An _______ represents a connection between two vertices in a graph.

hash table

A ______ is a data structure that stores unordered items by mapping (or hashing) each item to a location in an array.

max-heap, min-heap

A _______ is a tree that maintains the simple property that a node's key is greater than or equal to the node's childrens' keys. A _____ is a tree that maintains the simple property that a node's key is less than or equal to the node's childrens' keys

queue

A _______ is an ADT in which items are inserted at the end of the queue and removed from the front of the queue. (linked list)

constant time operation

A __________ is an operation that, for a given processor, always operates in the same amount of time, regardless of input values.

binary

A _______________ search is more efficient than a linear search.

linear

A __________________ search looks through the search pool one element at a time.

Record

A _________is the data structure that stores subitems, often called fields, with a name associated with each subitem.

linked list

A ________is a data structure that stores an ordered list of items in nodes, where each node stores data and has a pointer to the next node.

binary tree

A ______is a data structure in which each node stores data and has up to two children, known as a left child and a right child.

linear

A growth function that is O(n) is ________

linear

A list is a ______________ collection

9

A list of 10 elements is to be sorted using insertion sort algorithm. How many times will the outer loop be executed?

Q(n)

A loop body is controlled by the following statement: for (int count = 2; count <= n; count +=2) If the statements in the body of the loop are all O(1), what is the order of the loop?

in a last-in-first-out fashion

A stack is a container that allows elements to be stored and removed ________.

stack

A______ is an ADT in which items are only inserted on or removed from the top of a stack.(Linked list)

can be implemented iteratively.

All recursive programs ___________

algorithm's runtime complexity

An __________ is a function, T(N), that represents the number of constant time operations performed by the algorithm on an input of size N.

algorithm's space complexity

An _______________ is a function, S(N), that represents the number of fixed-size memory units used by the algorithm for an input of size N

array

An _________is a data structure that stores an ordered list of items, where each item is directly accessible by a positional index.

11

Assume an ordered list containing the English alphabet. Using linear search, how many letters are checked to locate the letter "K"?

upper bound

Big - Oh notation establishes a(n) ____________ on a growth function

The number of comparisons made to process each item

When evaluating an algorithm, which of the following most likely contributes to the efficiency of the algorithm?

O(N^2)

Which is the worst case runtime for a quicksort algorithm?

O(1)

Which of the following complexity measures is the most efficient?

The program will run out of memory.

Which of the following will result from infinite recursion in Java?

radix sort

Which sorting technique does not compare two values and then sort the values?

Comparator objects

________ can be used to sort the same set of objects in multiple ways

Linear search

__________ is a search algorithm that starts from the beginning of a list, and checks each element until the search key is found or the end of the list is reached.

Big O notation

_____________ is a mathematical way of describing how a function (running time of an algorithm) generally behaves in relation to the input size.

Infinite

_____________ recursion results from the lack of a base case.

Binary search

______________ is a faster algorithm for searching a list if the list's elements are sorted and directly accessible (such as an array). Binary search first checks the middle element of the list. If the search key is found, the algorithm returns the matching location. If the search key is not found, the algorithm repeats the search on the remaining left sublist (if the search key was less than the middle element) or the remaining right sublist (if the search key was greater than the middle element).

direct, indirect

____________________ recursion occurs when a method calls itself, while _________________ recursion when a method calls another method that then calls the original method.

5

Given an array with 32 elements, how many list elements will be checked if the key is less than all elements in the list, using binary search?

largest exponent of the variable

If the growth function for an algorithm is expressed as a polynomial, then the asymptotic complexity of the algorithm is determined by the term with the ________________ .

it is assumed that the search pool is ordered.

In a binary search, _______________________________ .

throw some appropriately defined exception

In an array-based implementation of a stack, an operation that needs to add a new element to the stack may not be able to complete because the array is full. In this case, the failed operation should ________.

leftmost

In selection sort, the smallest element is selected and swapped with the _____ unsorted element.

Zero

Inserting an item at the beginning of a 999-item linked list requires how many items to be shifted?

nodes

Linked lists are made up of individual ________.

10

Suppose a sorted list of 1024 elements is searched with binary search. How many distinct list elements are compared against a search key that is less than all elements in the list?

n^3

Suppose that a loop executes n times. The loop contains a method call whose order is O(n2), and some other statements that are O(1). From a complexity standpoint, the order of the loop is

False

T/F: A linked list stores items in an unspecified order.

True

T/F: A list node's data can store a record with multiple subitems.

True

T/F: A node in binary tree can have zero, one, or two children.

True

T/F: An algorithm with a polynomial runtime is considered efficient.

True

T/F: An iterator provides a way to retrieve items from a list in a sequential manner.

False

T/F: Elements can be added only to one end of a linked list.

False

T/F: If the growth function for an algorithm is expressed as a polynomial, then the asymptotic complexity of the algorithm is determined by the term with the smallest exponent of the variable.

insertion sort

The __________________ algorithm sorts a list of values by repetitively inserting a particular value into a subset of the list that has already been sorted.

bubble sort

The ___________________ algorithm sorts values by repeatedly comparing neighboring elements in the list and swapping their position if they are not in order relative to each other.


Related study sets

International Business Law Final Exam

View Set

Skinner's Box, operant conditioning

View Set

International Business Midterm (set 2/2)

View Set

Ch. 15: Managing Marketing Channels and Supply Chains

View Set

Appendix B4 - Joint and conditional distribution

View Set

My review for Business Benchmark

View Set

Chapter 7: Access Control List (NetAcad) (Exam)

View Set