CS 121 Final

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

open addressing

The __________ method for handling collisions looks for another open position in the table other than the one to which the element is originally hashed.

binary, O(log n), sorted

A ___________ search eliminates half of the search pool with each step and thus is _________ as long as the search pool is ____________.

not sorted

A binary search capitalizes on the fact that the list is _____________.

half

A binary search eliminates _________ of the viable candidates with each comparison.

True

A binary search tree has the ordering property that the left child of any node is less than the node, and the node is less than or equal to its right child. A minheap is complete and has the ordering property that the node is less than both of this children.(true/false)

right child

A binary search tree is a binary tree with the added property that the left child is less than the parent, which is less than or equal to the _____________.

trace

A careful ________ of recursive processing can provide insight into the way it is used to solve a problem

Binary Tree

A collection where each node can have from 0 to 2 children is called a _____________.

perfect

A hashing function that maps each element to a unique position in the table is said to be a ___________ hashing function.

True

A heap is considered complete if it is balanced, meaning all of the leaves are at level h or h-1 where h is log2n and n is the number of elements in the tree, and all of the leaves at level h are on the left side of the tree. (true/false)

True

A heap never needs be rebalanced, because by definition, a complete heap is balanced and the algorithms for add and remove maintain that balance.(true/false)

static, class, object

A method or variable is made static by call the _________ modifier in the declaration. A static variable or method belongs to the ___________ and not the ___________ instance.

True

A minheap has the ordering property that the node is less than both of its children. A maxheap has the ordering property that the node is greater than both of its children.(true/false).

root, leaf

A minheap stores its smallest element at the __________ of the binary tree. Typically, in heap implementation, we keep track of the position of the last node or, more precisely, the last _____________ in the tree.

root

A node that does not have a parent is called the ___________ of a tree.

infinite recursion

A recursive definition without base-case will lead to _____________.

hierarchy

A tree is a nonlinear structure who's elements are organized into a ___________.

3 5 5 9

After one pass on the numbers (5 3 9 5), what would be the result if you were to use Bubble Sort?

iterator

An ___________ is an object that provides a means to iterate over a collection.

maximizes

An efficient search ________ the number of comparison made.

minimizes

An efficient search __________ the number of comparisons made.

implements

An interface name can be used to declare an object reference variable. An interface reference can refer to any object of any class that __________ the interface.

base case

Any recursive definition must have an non-recursive par, called the_____________, which permits the recursion to eventually end.

parent

Because of the requirement that we be able to traverse up the tree after an insertion, it is necessary for the nodes in a heap to store a painter to their ___________.

children

Each BinaryTreeNode object maintains a reference to the element stored at that node as well as references to each of the node's ______________.

local variables and parameters

Each recursive call to a method creates new_________.

only a part

Extraction involves using ______________ of the elements value of key to compute the location at which to store the element.

n log n

Heap sort is ___________.

2n+1 and 2(n+1)

IN the computational strategy to implement a tree with an array, the children of node n are stored at ______ and _______ respectively.

balanced

If a binary search tree is not _________, it may be less efficient than a linear structure.

compareTo

If a class implements Comparable, it must have/override the ___________ method.

log of m base n

In general, a balance n-ary tree with m elements will have height _____________.

promoted

In removing an element from a binary seearch tree, another node must be _______________ to replace the nod being removed.

added

In the shift folding method, the parts of the key are ____________ together to create the index.

polymorphic

Interface allow us to make ____________ references, in which the method that is invoked is based on the particular object being referenced at the time.

true

Java provides a hashcode method for all objects(true/false)

efficient

One of the uses of trees is to provide ____________ implementation of other collections.

comparable

Only ___________ objects can be stored in an ordered list.

method

Recursion is a programming technique in which a ___________ calls itself.

some

Recursion is the most elegant and appropriate way to solve __________ problems, but for others it is less intuitive than an iterative solution.

Complete Tree

Since a heap is a _________, there is only one correct location for the insertion of a new node, and that is either the next open position form the left a level h or the first position on the left a level h+1 if level h is full.

red/black

The Java Collections API provides two implementations of balanced binary search trees, TreeSet and TreeMap, both of which use a _____________ tree implementation.

exponential

The Towers of Hanoi solution has _____________ complexity, which is very inefficient. Yet the implementation of the solution is incredibly short and elegant.

division

The ___________ method is very effective when dealing with an unknown set of key values.

heap sort

The ____________ method consists of adding each of the elements of the list to a heap and then removing them one at a time.

length dependent

The _____________ method and the mid-square method may also be effectively used with strings by manipulating the binary representation of the characters in the string.

load factor

The ______________ is the maximum percentage occupancy allowed in the hash table before it is resized.

log n

The addElement operation for both the linked and array implementation(order) is _____________.

False

The addElement operation for the array implementation must determine the parent of the node to be inserted so that a child pointer of that node can be set to the new node(true/false)

False

The addElement operation for the linked implementation does not have to determine the parent of the new node because the new element is inserted in position count of the array and its parent is determined by position in the array.(true/false).

log n

The balance restriction on a red/black tree is somewhat less strict than that than that for AVL trees. However, in both cases, the find operation is order__________.

O(n log n)

The best (fastest) comparison sort in terms of order is ______________.

collisions

The chaining method for handling _______________ simply treats the hash table conceptually as a table of collections rather than as a table of individual cells.

true

The consequence of not having a good hashing function is having too many elements mapped to the same location in the table, which results in poor performance.(true/false)

binary tree

The definition of a binary search tree is an extension of the definition of a __________.

True

The height of the right subtree minus the height of the left subtree is called the balance factor of a node.

three

The java collections API contains __________ implementations of an indexed list.

Min and max

The leftmost node in a binary search tree will contain the _________ element, while the rightmost node will contain the _____________ element.

false

The length-dependent method and the mid-square method must not be used with strings(true/false)

iterative

The order of a recursive algorithm can be determined using techniques similar to analyzing __________ processing.

log n

The removeMin operation for both the linked and array implementation is __________.

completeness

The simulated link strategy allows array positions to be allocated contiguously regardless of the ___________ of the tree.

collision

The situation where two elements or keys map to the same location in the table is called a ______________.

n log n

The time complexity of Quick sort is __________?

addElement

The__________method adds a given Comparable element to the appropriate location in the heap, maintaining both the completeness property and the ordering property of the heap.

Priority Queue

Though not a queue at all, a minheap provides an efficient implementation of a ____________.

int

What type does the comparTo method return?

Quick Sort and Merge Sort

Which sort methods have smaller(faster) complexity compared to the others?

Level Order

__________ traversal means visit the nodes at each level, one level at a time, starting with root.

shift folding

___________ is dividing the key into parts(usually the same length as the desired index) and then adding the parts. Extraction or divisions is then used to get an index within the bounds of the table.

length dependent

___________ is the key and the length of the key are combined in some way to form either the index itself or an intermediate value that is then used with one of our other methods to form the index.

searching

___________ is the process of finding a designated target within a group of items or determining that it doesn't exist.

chaining

___________ treats thee hash table conceptually as a table of individual cells, Thus each cell is a pointer to the collection associated with that location in the table. Usually this internal collection is either an unordered list or an ordered list.

radix transformation

____________ is a variation on the division method where the key is first converted to another numeric base and then divided by the table size with the remainder used as the index.

boundary folding

____________ is dividing the key into parts(usually the same length as the desired index). However, some of the parts are then reversed before adding. One example is to imaigne that the parts are written side by side on a piece of paper, which is then folded on the boundaries between parts. In this way, every other part is reversed.

sorting

____________ is the process of arranging list of items into a defined order based on some criteria.

extraction

____________ is using only a part of the elements value of key to compute the location at which to store the element.

Mathematical

____________ problems and formulas are often expressed recursively.

Inorder

____________ traversal means visit the left child, then the node, then the right child.

Postorder

____________ traversal means visit the left child, then the right child, then the node.

Minheaps

_____________ are complete binary trees in which each node is less than or equal to both the left child and right child.

division

_____________ is dividing the key by some positive integer p (usually the table size and usually prime) and then using the remainder as the index.

mid square

_____________ is multiplying the key by itself and then extracting some number of digits or bytes from the middle of the result. Division can then be used to guarantee and index within the bounds of the table

open addressing

_____________ looks for another open position in the table other than the one to which the element is originally hashed.

Preorder

______________ traversal means visit the node, then the left child, then the right child.

digit analysis

____________where the index is formed by extracting, and then manipulating, specific digits from the key.

indexed list

an _______ maintains a contiguous numeric index range for its elements.

location

in hashing, elements are stored in a hash table, with their __________ in the table determined by hashing function.

added

many common operations can be defined for all list types. The difference between them stem from how elements are __________.

ordered list

the elements ____________ have an inherent relationship defining their order.

unordered list

the elements of an __________ are kept in whatever order the client chooses.

true

the goal of the hashing function is to simply do a good job of distributing elements into a position in the table. (true/false).


Kaugnay na mga set ng pag-aaral

Patrick Physical Science Module 13

View Set

Networking 1 CH 8 Exam Questions

View Set

Security+ 2.0 Compliance and Operational Security (18%)

View Set

Biology Exam #2 - Ch. 5, 7, 8, 25

View Set

SCIENCE FORM 4 - 3.3 BLOOD PRESSURE

View Set

The Industrial Revolution Quiz Review Modules 15.1 & 15.3

View Set