1/31
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
|---|
No study sessions yet.
True or False: If there exists a recursive solution to a problem you should always opt to use it over any iterative solution
False
Every ____ call requires that the system allocate memory space for its formal parameters and local variables, and then deallocate the memory space when the method exits.
Recursive
True or False: Every (recursive) call also has its own set of parameters and local variables.
True
True or False: There are usually two ways to solve a particular problem – iteration and recursion.
True
A linked list is a collection of components, called ____.
Nodes
True or False: Using two reference variables can simplify the insertion code for a linked list.
True
True or False: Computers use stacks to implement method calls.
True
What statement can you issue to run the garbage collector?
System.gc();
A(n) _______ is a list of homogeneous elements where addition and deletion occur only at the top of the stack.
Stack
A stack is also called a(n) ______ data structure.
Last In First Out (LIFO)
add(value)
appends value at end of list
add(index, value)
inserts given value just before the given index, shifting subsequent values to the right
clear()
removes all elements of the list
indexOf(value)
returns first index where given value is found
in list (-1 if not found)
get(index)
returns the value at given index
remove(index)
removes/returns value at given index, shifting
subsequent values to the left
set(index, value)
replaces value at given index with given value
size()
returns the number of elements in list
toString()
returns a string representation of the list
such as "[3, 42, -7, 15]"
addAll(list)
addAll(index, list)
adds all elements from the given list to this list
(at the end of the list, or inserts them at the given index)
contains(value)
returns true if given value is found somewhere in this list
containsAll(list)
returns true if this list contains every element from given list
equals(list)
returns true if given other list contains the same elements
iterator()
listIterator()
returns an object used to examine the contents of the list
(seen later)
lastIndexOf(value)
returns last index value is found in list (-1 if not found)
remove(value)
finds and removes the given value from this list
removeAll(list)
removes any elements found in the given list from this list
retainAll(list)
removes any elements not found in given list from this list
subList(from, to)
returns the sub-portion of the list between
indexes from (inclusive) and to (exclusive)
toArray()
returns the elements in this list as an array
The statement, ____, creates a node somewhere in memory and stores the address of the newly created node
in newNode
newNode = new Node();
In a stack, the ____ operation removes the top element from the stack.
pop