Final Flashcards
(42 cards)
O(1)
Called bounded time
Amount of work is not dependent on the size of the problem
Adding an item to an array has an order of O(1)
O(log2n)
Called logarithmic time
Used with algorithms that can cut the amount of data to be processed in half
Binary Search would be O(log2N)
O(N)
Called linear time
Adding together the elements of an array is O(N)
O(N log2N)
Called N log N time
Quick sort, Heapsort, merge sort have N log N complexity
O(N2)
Called quadratic time
Some simple sorting algorithms are O(N2)
O(2N)
Called exponential time
Are extremely costly
T or F
LLObjectNode class is a self referential class
True
When comparing two objects using the equals method inherited from the Object class, the contents of the objects are being compared
T or F
False
JDK has always contained the Java Collections Framework
T/F
False
Stack is FIFO
T/F
False
We allow duplicate elements in our lists
True
Final variable
Holds a value that cannot be changed
Which sequence of operations leaves a stack unchanged?
Push and then pop
The stackunderflowexception could be thrown by which stack methods?
Pop and top
The stackoverflowexception can be thrown by
The push method
One method calls another method which calls another method, the activation records are stored in
A stack
Unchecked exceptions are directly derived from
Runtime Exception
Which method of the Object class returns a string representing some of the internal system implementation details of the object
The toString method
Elements of an enum are….
Uppercase and constant
Pop operation
Removes top element of a stack
Push operation
Adds an element to the top of a stack
Java implicitly supplies a reference to each instance. This reference is called…
This
Why does the pop operation from the stack class require no parameters
It takes the parameter of the value that was push
Difference between checked and unchecked exceptions….
Unchecked:
References defects in the program
Errors in code
Subclass of runtime exception
Checked:
Invalid conditions in areas outside the immediate control of the program(user input, database problems)
Subclasses of Exception