
















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

















"____ is like a queen bee, kept hidden in the middle of the hive, fed and cared for by worker-bee methods" - ANSData {a = new long [size]; } is an example of what? - ANSCreating an array A field in the list itself contains a reference to: - ANSThe first link. A field of method that is private can only be accessed by - ANSMethods that are apart of the same class. A leaf node has no children but can contain up to how many data items? - ANS A tree consists of ______ connected by________. - ANSnodes(represented by circles),edges(represented by connecting lines). An object is often referred to as: - ANSAn instance of a class. Any outside entity that wants to access data in a class can do so by: - ANSUsing a method of that class. arr = new long [100];is an example of: - ANSCreating an array.
Breaking up the program into classes does what? - ANSMakes it easier to design, understand, modify and maintain the program. Briefly explain the class DataItem in Java code for a 2-3-4 Tree. - ANSDataItem contains :
Execution of the program starts where? - ANSmain() Explain how to split a 2-3-4 tree with data items ABC. - ANS1.A new, empty node is created as a sibling to the node being split and placed to the right
Explain what happens when a node is visited. - ANSThis happens when a program control arrives at the node, usually for the purpose of carrying out some operation on the node, such as checking the value of a data field or displaying it. Passin over one node to get to another is NOT a visit. First two steps of object-oriented approach? - ANS1. Separate the data structure storage from the rest of the program(now called the user).
How do we delete a node that has one child? - ANSWe "snip" the node out of its sequence by connecting it's parent directly to its child. We must change the appropriate reference in the parent directly to it's child. How do we delete a node that has two children? - ANSDelete the node and replace it with its inorder successor. How does a hash function work? - ANS1. We convert a word into a huge number by multiplying each character in the word by an appropriate power of 27 and set it equal to hudgeNumber
How is "peek" different in a queue? - ANSIt "peeks" at the value of the item at the front of the queue without removing it as opposed to the last value in a stack. How is a priority queue different than a queue? - ANSA priority queue items are ordered by key value so that the item with the lowest key ( or in some implementations the highest key) is always at the front. Items are inserted in the proper position to maintain the order. How is finding an element in a list different than finding an element in an array? - ANSAn item in an array can be accessed by directly accessing it's index. In a list an item can't be accessed directly; you must use the relationship between the items to access it. How is the constructor named? - ANSIt has the same name as the class it resides in. How many "children" are a binary tree allowed? - ANS2 max. How quick is a hash table? - ANSInsertion and searching taks close to constant time, 0(1) making it essentially instantaneous. How would you convert the word "money" into a multi-digit number? - ANS1. Convert each digit into a number. I can use my own code instead of ASCII. So I would set a=1, b=2 and so on. I would set blank = 0 to accomodate for for a space giving my 27 characters.
is an example of what? - ANSGet value public LowArray(int size) is an example of what? Note that LowArray is also the name of the class. - ANSCreating a Constructor. public void setElement(int index, long value) {a[index] = value; is an example of what? - ANSSet value Representing a tree with an array inefficient. Why? - ANSUnfilled nodes and deleted nodes leave holes in the array, wasting memory. Also when deletion of a node involves moving subtrees, every node in the subtree must be moved to its new location in the array, which is time-consuming in large trees. Rotations must do what two things at once? - ANS1.Raise some nodes and lower others to help balance the tree 2.Ensure that the characteristics of a binary search tree are not violated. The keyword "new" is used to do what? - ANSCreate a new object in Java. To create an object in Java you must do two things: - ANS1. Use the keyword "new"
Unless its a link a 2-3-4 tree node with one data item must have at least how many links? - ANS Unlike a stack, the items in a queue don't always: - ANSextend all the way down to index 0. Use the postal analogy to describe stacks. - ANS... We are missing a class: the class to: - ANSinstantiate the class itself. We number the data items in a link from __ to __ and the child links from ___ to ___. - ANS0 to 2 0 to 3 What algorithm is Shellsort based on? - ANSInsertion sort. What are characteristics of the red-black tree? - ANSThe nodes are colored and during insertion and deletion rules are followed that preserve various arrangements of these colors. What are invariants? - ANSConditions that remain unchanged as the algorithm proceeds. What are programmer's tools? - ANSData structure storage that is accessed by the program itself. Ex - stacks and queues. What are stacks allowed access to? - ANS...
What are the three steps to delete an item in an array? - ANS1.Search for the item
What does the parse.Int() method do? - ANSConverts the string type into an integer. What does the searchKey variable do? - ANSIT holds the value we are looking for. What evolved from the 2-3-4 tree? - ANSThe red-black tree. What happens to non delimiter characters? - ANSThey are not inserted onto the stack; they are ignored. What is "peek"? - ANSIt allows the user to read the value at the top of the stack with out removing it. What is "popping"? - ANSRemoving a data item from the top of the stack. What is a B-tree? When is it useful? - ANSA multiway tree that is useful when data resides in external storage. What is a binary search tree? - ANSA binary tree in which the nodes left child has a key value less than it's parent and it's right child must have a key that's great than or equal to its parent. What is a binary tree? - ANSA tree in which each node can have only two children: a left child and a right child. What is a class? - ANSA blueprint that defines an objects variables and methods. What is a cluster? - ANSA cluster occurs during linear probing. Once a cluster
What is a Huffman tree? - ANSA binary tree used in a data-compression algorithm called Huffman Coding. What is a leaf? - ANSA node that has no children. What is a level? - ANSThis represents how many generations the node is from the root. The root is level 0, it's children level 1 and so on. What is a link? - ANSA data item embedded in a linked list. It is an object of a class. What is a null child? - ANSA child that non-leaf node might have, but doesn't. What is a null child? - ANSits a place where a child could be attached to a non-leaf node; a node that already has one child. What is a path? - ANSThe way in which a sequence of nodes is connected. What is a red-black tree? What problem does it solve? - ANSA red-black tree is a binary search tree that What is a reference? - ANSA number that refers to an object. It's the objects address in the computers memory. What is a sorted list? - ANSA list in which the items are in sorted order by key value. What is a subtree? - ANSA node with two children. The children have no children.
What is a symbol table? - ANSA symbol table is a data structure that associates a value with a key. It It supports two primary operations: insert (put) a new pair into the table and search for (get) the value associated with a given key. The symbol table holds all the variable and function names made up by the programmer, along with the address where they can be found in memory. What is an ADT list? - ANSSometimes called a linear list, it is a group of items arranged in a linear order. What is an ADT? - ANSAn Abstract Data type is a conceptual tool. It suggests that we describe the fields and methods of a class while excluding how the methods carry out their tasks. Ex I know that I need to use push() and pop() but don't know how the code for these methods are written. What is an array? - ANSA container object that holds multiple values of the same type. What is an iterator? - ANSAn Object containing references to items in a data structure, used to traverse through the structure. What is an object? - ANSA software bundle of variables and related methods. What is bottom-up insertion? - ANSFinding a place to insert the node and then working back up through the tree making structural changes. What is double hashing? - ANSIt eliminates both primary and secondary hashing.
What is public static void main(String args[])? - ANSThis is a main() method with three modifiers What is Quadratic probing? - ANSQuadratic probes eliminate the clustering of a linear probe. In a linear probe the primary hash index is x. Subsequent probes go to x+1, x+2, x+3 etc. In quadratic probing, probes go to x+1, x+4, x+9, X+16, x+25 and so on. (The distance from the initial probe is always the square of the step number) What is Radix sort? - ANSThis sort examines each digit of the key separately, starting with the least significant digit. All the data items are divided into 10 groups. These 10 groups are then reassembled starting with all the keys that end in 0, followed by all keys ending in1 and so on (up to keys ending in 9). These steps are a sub-sort. In the next sub-sort, all is divided into 10 groups again, but in order of their 10s digit. This is done without changing the order of the previous sort. The sub-sorts must be stable. The groups are recombined, those w a 10s digit of 0 first up to 9. This process is repeated. What is real-world modeling? - ANSData structures that directly model real- world situations...think graphs. What is real-world storage data? - ANSData structure storage that describes physical entities external to the computer. Accessed by a programs user. What is recursion? - ANSA programming technique in which a method calls itself. What is rotating? Why is this term misleading? - ANSThe term is misleading because the nodes themselves are not rotated; it's the relationship between them that changes. One node is chosen as the "top" of the rotation. In a right rotation, the "top" node will move down to the right, into the right child's position. The left child moves up to take it's place.
What is secondary clustering? - ANSIt occurs when the algorithm that generates the sequence of steps in the quadratic probe always generates the same steps: 1,4,9,16,25, etc. What is separate chaining? - ANSAnother way to fix a collision. We create an array that consists of linked list of words instead of the words themselves. Then when a collision occurs,the new item is simply inserted in the list at that index. What is the "push"? - ANSPlacing a data item on top of the stack. What is the % operator in java? - ANSThe modulo operator finds the remainder when one number is divided by another. What is the advantage of using a doubly linked list? - ANSIt allows you to transverse forward and backward in a list. Each list links to the next link (just like in reg. lists) and to the previous link. What is the ASCII code? - ANSIts a way to represent individual characters as numbers. a is 97, b is 98, c is 99 and so on. It runs from 0 to 255 to accomodate capitals and punctuation. What is the best way to flip colors? - ANSThe parent switches color with its children at the same time. What is the black height? - ANSThe number of black nodes on a path from root to leaf.