Data Structures Midterm Study

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

When an item is deleted from the hash table indexStatusList at position, say k, we set indexStatusList[k] to ____. -1 0 2 1

-1

The scope resolution operator is ____. : * :: ;

::

A(n) ____ is a step-by-step problem-solving process in which a solution is arrived at in a finite amount of time. Design Plan Algorithm Process Plan Structured Program

Algorithm

If a dynamic variable is no longer needed, it can be ____. reassigned recycled reconstructed destroyed

Destroyed

A search in a B-tree must start at the bottom node.

False

All insertions and searches in the random probing method use a different sequence of random numbers.

False

As in the case of an inorder traversal, in a postorder traversal, the first node visited is the rightmost node of the binary tree.

False

Building a linked list forward places the new item to be added at the beginning of the linked list

False

Encapsulation is the ability to create new data types from existing data types (T/F)

False

In a preorder traversal of a binary tree, after visiting a node and before moving to the right subtree, we must save a pointer to the node so that after visiting the right subtree, we can visit the left subtree.

False

In a preorder traversal of a binary tree, for each node, first the node is visited, then the right subtree is visited, and then the left subtree is visited.

False

In heapsort, only the elements at position 2k + 1 are accessed frequently.

False

Insertion sort cannot be applied to linked lists.

False

Item insertion and deletion in a linked list requires significant data movement.

False

The algorithms to implement the operations search, insert, and remove are the same for sorted and unsorted lists.

False

The call to the recursive function contains a statement that causes the same function to execute again before completing the current call.

False

The class deque contains only one constructor

False

The performance of a binary search tree depends on the width of the tree.

False

The queue operation end returns the last element of the queue

False

The sequential search always starts at the last element in the list and continues until either the item is found in the list or the entire list is searched.

False

The time complexity of the function seqSearch in an array list is O(n^2)

False

When converting the subtree into a heap, if the root node of the subtree is larger than the larger child, we swap the root node with the larger child.

False

A queue is a ____ data structure. First in last out First in first out Last in first out Last in last out

First in first out

____ iterators, with read access, step forward element-by-element and so return the values element-by-element. Output Migration Standard Input

Input

____ sort sorts the list by moving each element to its proper place. Quick Bubble Selection Insertion

Insertion

A stack is a ____ data structure. last in last out (LILO) first in last out (FILO) first in first out (FIFO) last in first out (LIFO)

Last in first out (LIFO)

A(n) ____ is a list of items, called nodes, in which the order of the nodes is determined by the address, called the link, stored in each node. structure hash table linked list array

Linked list

Because initially the list is empty, the pointer first must be initialized to ____. NIL NULL EMPTY NOP

NULL

The worst-case behavior of quicksort is ____. O(n) O(n^2) O(1) O(nlogn)

O(n^2)

A vector is a type of ____. iterator container adapter associative container sequence container

Sequence container

A derived class can have a constructor with default parameters

True

A stack is a list of homogenous elements in which the addition and deletion of elements occurs only at one end.

True

After inserting the new element in the heap, the list might no longer be a heap.

True

An array is a random access data structure; a stack is not.

True

An element can be removed from the stack only if there is something in the stack, and an element can be added to the stack only if there is room.

True

Every call to a recursive function requires the system to allocate memory for the local variables and formal parameters

True

Every node has two components; one to store the address and one to store relevant information.

True

From the binary search algorithm, it follows that every iteration of the while loop cuts the size of the search list by half.

True

If g(n) = 1, the growth rate is constant and does not depend on the size of the problem (T/F)

True

Initially, in a selection sort we consider that the entire list is unsorted.

True

Mergesort uses the divide-and-conquer technique to sort a list.

True

Polymorphism is the ability to use the same expression to denote different operations (T/F)

True

Sorted sublists are merged into a sorted list by comparing the elements of the sublists, and then adjusting the references of the nodes with the smaller info.

True

The address of the first node in a linked list is stored in a separate location, known as the head

True

The keys of the items in a data set are used in such operations as searching, sorting, insertion, and deletion.

True

The length of the list is the number of elements in the list

True

The notion of a queue in computer science is the same as the notion of the queues to which you are accustomed in everyday life

True

The post fix expression 7 3 + 2 * evaluates to 20

True

The queue is empty if queueFront is NULL

True

The time complexity of the function isEmpty is an array list is O(1)

True

When inserting an element in the priority queue, restoring the heap might result in moving the new entry to the root node.

True

When overloading an operator, the meaning of how an operator works with built-in types remains the same

True

The header node is placed at the ____ of a list. end key location beginning middle

beginning

Random access iterators are ____ iterators that can randomly process elements of a container. bidirectional input output forward

bidirectional

Inserting the new element in the first available position in the list ensures that the array holding the list is a complete ____. forest heap binary tree selection tree

binary tree

The first step in the heapsort of this chapter is to convert the list into a heap, called ____. buildHeap newHeap convertHeap addHeap

buildHeap

The name of a constructor is the same as the name of the ____. class main function helper function friend function

class

Sequential and binary search algorithms are called ____ search algorithms. comparison-based key-based cumulative compartmentalized

comparison-based

Assuming the priority queue is implemented as a heap, the first step is to insert the new element in the ____ available position in the list. largest last smallest first

first

In a linked list, we always want head to point to the ____ node. key main first last

first

One way to improve linear probing is to skip array positions by a ____. key-relative value dynamic value random constant fixed constant

fixed constant

With selection sort, we can keep track of the unsorted portion of the list and repeat the steps involved with sorting with the help of a ____ loop. when while for do

for

In the function ____, the growth rate is exponential. g(n) = 1 g(n) = nlog2n g(n) = n^2 g(n) = 2^n

g(n) = 2^n

In the function _____, the growth rate is quadrupled when the problem size is doubled. g(n) = 1 g(n) = nlog2n g(n) = n^2 g(n) = 2^n

g(n) = n^2

In hashing, the data is organized with the help of a table, called the ____. relative table hash table index table key table

hash table

To ensure that the largest element of the priority queue is always the first element of the queue, we can implement priority queues as ____. heaps piles trees stacks

heaps

If the list is stored in an array, we can traverse the list in either direction using an ____. iterator variable increment variable index variable interface variable

index variable

In an array list the time complexity of the remove function is identical to the time complexity of the ____ function. insert maxListSize isFull isEmpty

insert

The ____ operation checks whether the stack is full. pop isEmpty isFullStack peek

isFullStack

A node in the binary tree is called a ____ if it has no left and right children. node branch root leaf

leaf

The sequential search is also called a ____ search. binomial non-linear linear quadratic

linear

The height of a perfectly balanced binary tree with n nodes is ____. n^2 n*log(n) log2(n) log(n)

log2(n) (Log base 2 of n)

In mergesort, all the comparisons are made in the method____, which merges two sorted sublists. divideList sortList insertList mergeList

mergeList

In ____, the data is stored within the hash table. closed addressing inverted addressing open addressing converted addressing

open addressing

To delete a node, we adjust one of the pointers of the ____. leaf node branch node parent node child node

parent node

Quicksort first selects an element in the list, called the ____, and then partitions the list so that the elements in one sublist are less than pivot. key primate pivot index

pivot

In a heap, the ____ is the largest element of the tree base node top node low node root node

root node

To determine whether the item to be inserted is already in the list, the insert function calls the _____ member function. copy size seqSearch isEmpty

seqSearch

In heapsort, after we convert the array into a heap, the ____ phase begins. inserting merging division sorting

sorting

A B-tree can be ____ in three ways: inorder, preorder, and postorder. inversed reversed traversed copied

traversed


Ensembles d'études connexes

Sociology Chapter 9 What is Deviance

View Set