


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!



push - put stuff inpop - take off of stacktop/peek - see the object on the top of the stack"LIFO" - last in first out, refers to the ordering in the stackwhen an object is added to the stack it is added to the top, and when an object is removed it is removed from the top. Can be implemented using the arraylist or a linked list. TERM 2
DEFINITION 2 join - requires the link to be split prior and links the object to the next then returns the object you called it on.split - sets the the link to null, and returns the object it was linked to.You can use sentinels to avoid special cases, when adding and removing links. TERM 3
DEFINITION 3 Same as the linked list except joined in both directions; therefore you can go through the list in either direction.With these and the single linked list you can do a tail share. TERM 4
DEFINITION 4 This is basically a circular array. You enqueue on one end and dequeue on the other. They both have efficiency of 1.when adding or removing an objectback = (back+1)%lengthfront = (front + 1)%length TERM 5
DEFINITION 5 Double ended que you can add and remove from both sides.
We use arrays over links because all the data is stored in the same place, unlike a linked list where it can be stored pretty much anywhere.Links however you can do a tail share. TERM 7
DEFINITION 7 System.arraycopy(contents, front, newcontents, 0, size)this was called for creating a new larger buffer. TERM 8
DEFINITION 8 height - full length of the tree to the furthest leaf based on counting from 1.depth - distance to a node start counting from 0.Recognized relations parent, child, sibling.root is the top, leaf are the nodes without childrenn = 2^h is the relation between leaves and height TERM 9
DEFINITION 9 to remove a node without children, just disconnect the leaf. With just one child then disconnect between the parent node and child then the child's child then connect the parent to the "grandchild".If the node has two children then replace it with the right most child on the left side, or the left most child on the right side. TERM 10
DEFINITION 10 reads left child- parent - right child
used for easily iterating through a collection.supports hasNext() - checks for the next objectnext() - returns current and moves to nextand remove() - removes a random objectnot wanted for tree, stack or que.This method is required when a class implements iterable,either it returns the object which is the iterator, whether it is a nested class which implements iterator, or the iterator defined for the class already such as for an array. TERM 17
DEFINITION 17 implemented by a class you wish to use it's iterartor. TERM 18
DEFINITION 18 when using the iterator next returns the last object not the current so you don't see the object until it is passed so remove removes the last object etc. TERM 19
DEFINITION 19 1 constantlogn cuts data in halfn linear for loopnlogn log linearn^2 quadraticn^3...... cubic2^n exponentialn! factorialn^n infinite shuffling by throwing in the air