205 jive

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

Root

The one tree node with no parent (the "top" node).

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

The stack peek operation ________.

Quicksort, merge sort, heap sort, radix sort

These are fast sorting algorithms

Shell sort, selections sort, insertion sort

These are slow sorting algorithms

predecessor

A BST node's _________ is the node that comes before in the BST ordering.

successor

A BST node's __________is the node that comes after in the BST ordering, so in A B C, A's successor is B, and B's successor is C.

List

A _____ is an ADT for holding ordered data, where the order is based on how the program insert or removes items. A ______may contain duplicate items.

doubly-linked list

A ________ is a data structure for implementing a list ADT, where each node has data, a pointer to the next node, and a pointer to the previous node. The list structure typically points to the first node and the last node. The doubly-linked list's first node is called the head, and the last node the tail.

generic class

A _________ is a class definition having a special type parameter that may be used in place of types in the class. A variable declared of that generic class type must indicate a specific type

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.

generic method

A ___________ is a method definition having a special type parameter that may be used in place of types in the method

Java collection

A ___________is an object that is used as a container for other objects

singly-linked list

A __________is a data structure for implementing a list ADT, where each node has data and a pointer to the next node. The list structure typically has pointers to the list's first node and last node. A singly-linked list's first node is called the head, and the last node the tail.

data structure

A __________is a way of organizing, storing, and performing operations on data. Operations performed on a data structure include accessing or updating stored data, searching for specific data, inserting new data, and removing data.

Stack

A ________is an ADT in which items are only inserted on or removed from the top of a stack. This is a last-in first-out ADT and can be implemented with list, array or vector.

Queue

A _____is an ADT in which items are inserted at the end of the queue and removed from the front of the queue. This is a first-in first-out ADT and can be implemented using a linked list or an array.

perfect

A binary tree is ______, if all internal nodes have 2 children and all leaf nodes are at the same level.

complete

A binary tree is _______ if all levels, except possibly the last level, contain all possible nodes and all nodes in the last level are as far left as possible.

full

A binary tree is________if every node contains 0 or 2 children.

dummy node

A linked list implementation may use a ___________ (or header node): A node with an unused data member that always resides at the head of the list and cannot be removed. Using a dummy node simplifies the algorithms for a linked list because the head and tail pointers are never null.

Internal node

A node with at least one child.

O(N^2)

A selection sort has a _____ runtime complexity.

positional list

A singly-linked list is a type of __________ A list where elements contain pointers to the next and/or previous elements in the list.

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.

constant time operation

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

array

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

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.

tail

An appended node always becomes the _____ of a linked list.

abstract data type (ADT)

An___________ is a data type described by predefined user operations, such as "insert data at rear," without indicating how each operation is implemented.

Inserts x at end of list

Append(list, x)

insertAfter()

Which LinkedList method inserts a new node in the middle of a list?

The list element at index mid is less than the key

Which does not describe a base case for BinarySearch

O(N⋅log(N))

Which is the worst case runtime for a quicksort algorithm?

Node nodeA = new Node(15); numList.append(numList,nodeA);

Which statements append a node with data value 15 to the numList?

Binary search tree (BST),

_______ which has an ordering property that any node's left subtree keys ≤ the node's key, and the right subtree's keys ≥ the node's key.

Comparator objects

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

Quicksort

________ is a sorting algorithm that repeatedly partitions the input into low and high parts (each part unsorted), and then recursively sorts each of those parts. To partition the input, quicksort chooses a pivot to divide the data into low and high parts.

Θ notation

_________ provides a growth rate that is both an upper and lower bound.

The list

_________ADT is the better match for the program's requirements.

Insertion sort

___________ is a sorting algorithm that treats the input as two parts, a sorted part and an unsorted part, and repeatedly inserts the next value from the unsorted part into the correct location in the sorted part.

Computational complexity

_____________-is the amount of resources used by the algorithm. The most common resources considered are the runtime and memory usage.

O notation

____________provides a growth rate for an algorithm's upper bound.

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

Selection sort

___________is a sorting algorithm that treats the input as two parts, a sorted part and an unsorted part, and repeatedly selects the proper next value to move from the unsorted part to the end of the sorted part.

Radix sort

__________is a sorting algorithm specifically for an array of integers: The algorithm processes one digit at a time starting with the least significant digit and ending with the most significant. Two steps are needed for each digit. First, all array elements are placed into buckets based on the current digit's value. Then, the array is rebuilt by removing all elements from buckets, in order from lowest bucket to highest.

Linear search

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

Merge sort

________is a sorting algorithm that divides a list into two halves, recursively sorts each half, and then merges the sorted halves to produce a sorted list. The recursive partitioning continues until a list of 1 element is reached, as a list of 1 element is already sorted.

Ω notation

______provides a growth rate for an algorithm's lower bound.

search

Given a key, a _______ algorithm returns the first node whose data matches that key, or returns null if a matching node was not found.

search

Given a key, a _______algorithm returns the first node found matching that key, or returns null if a matching node is not found. A simple BST search algorithm checks the current node (initially the tree's root), returning that node as a match, else assigning the current node with the left (if key is less) or right (if key is greater) child and repeating. If such a child is null, the algorithm returns null (matching node not found).

Insert

Given a new node, a BST___________operation inserts the new node in a proper location obeying the BST ordering property. A simple BST insert algorithm compares the new node with the current node (initially the root).

before the methods return type

In a generic method, a type parameter is defined ____

generic type

In the declaration ArrayList, T is a(n) _________.

Zero

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

Push(stack, x)

Inserts x on top of stack

INORDER

Left, Root, Right

null

removeAfter() removes the list's head node if the currentNode argument is _____.

One advantage of generics

that more type problems can be uncovered at compile-time rather than at run time

Examples of Arrays

List, Dynamic Array, Bag

Examples of Linked Lists

List, Stack, Queue, Deque, Bag

for loop inside a for loop inside a for loop

N cubed

For loop inside of for loop

N squared

Merge Sort Algo

O(N log N)/ Linearithmic

Selection Sort Algo

O(N2)Quadratic

POSTORDER

Postorder Left, Right, Root

Inserts x at start of list

Prepend(list, x)

Pop(stack)

Returns and removes item at top of stack

Peek(stack)

Returns but does not remove item at top of stack

GetLength(stack)

Returns the number of items in the stack

IsEmpty(stack)

Returns true if stack has no items

PREORDER

Root, Left, Right

True

T/F: A Comparator can use as many fields as needed. Ex: All of an InventoryItem's fields could be used to sort first by price, then by number in stock, then by name.

True

T/F: A Set holds a unique group of values/objects.

True

T/F: A key advantage of generic classes is relieving the programmer from having to write redundant code that differs only by type.

True

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: A node's data must be an integer.

False

T/F: An empty LinkedList has a single node with a data value of null.

True

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

True

T/F: Copying all characters in the string would require more operations for longer strings. But assignment of a pointer/reference is a constant time operation.

True

T/F: If a program requires fast insertion of new data, a linked list is a better choice than an array.

True

T/F: Searching for a key that is not in the list yields the worst case runtime for search.

True

T/F: Stack's push() method calls LinkedList's prepend() method because new elements are placed on the top of the stack, not at the bottom of the stack.

True

T/F: The Node class has two data members.

False

T/F: The Stack class' push() method takes a Node as an argument.

False

T/F: The data value of a node is set to null if the node is not in a list.

True

T/F: The dummy node's next pointer points to the first list item.

False

T/F: The head and tail node references are public in the LinkedList class.

True

T/F: When sorting an array of n 3-digit integers, RadixSort's worst-case time complexity is O(n).

True

T/F: pop() uses LinkedList's removeAfter() method to remove the top element of the stack, which is the head of the stack's LinkedList data member.

worst-case runtime

The ___________ of an algorithm is the runtime complexity for an input that results in the longest execution. Other runtime analyses include best-case runtime and average-case runtime. Determining the average-case runtime requires knowledge of the statistical properties of the expected data inputs.

declares a generic type that implements the Comparable interface

The notation < E extends Comparable > _____


Set pelajaran terkait

Nutritional Science 1301 Chapter 4

View Set

Greetings and asking how are you

View Set

La lengua que heredamos, Capítulo 1

View Set

Bios 1700 Chapter 6 Learning Curve

View Set

Ch 7 Antibacterial Drugs that Disrupt the Bacterial Cell Wall

View Set