Exam 1 Flashcards

Ch. 11-14

1
Q

The efficiency of an algorithm is usually expressed in terms of its use of __________ ____.

A

processing time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

The _______ __ ___________ involves categorizing an algorithm in terms of efficiency.

A

analysis of algorithms

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

For every algorithm we want to analyze, we need to define the ____ of the problem

A

size

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

For a searching algorithm, the size of the problem is the size of the _________ ____

A

searching pool

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

For a sorting algorithm, the size of the problem is the ______ __ ________ to be sorted

A

number of elements

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

CPU processing time

A

time complexity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

memory space

A

space complexity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

A ______ ________ shows the relationship between the size of the problem (n) and the value optimized (time).

A

growth function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

__________ __________ is based on the dominant term of the growth function - the term that increases most quickly as n increases

A

Asymptotic complexity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Asymptotic complexity is called the _____ of the algorithm

A

order

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

We say that an algorithm is order n^2 which is written ____

A

O(n^2)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Processor speed and memory ______ make up for the differences in efficiency of algorithms.

A

cannot

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

As n increases, the various growth functions diverge ____________

A

dramatically

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

nested loops: multiply the complexity of the _____ ____ by the complexity of the _____ ____

A

outer loop; inner loop

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

to analyze loop execution: first determine the order of the ____ of the loop, then multiply that by the _____ __ _____ the loop will execute

A

body; number of times

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

We can use _________________ to measure elapsed execution time in Java

A

System.nanoTime()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

A __________ is an object that holds and organizes another object. It provides operations for accessing and managing its elements

A

collection

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Some collections are ______ in nature, others are _________

A

linear; non-linear

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

A linear collection is one in which the elements of the collection are organized in a ________ ____

A

straight line

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

A nonlinear collection is one in which the elements are organized in something other than a straight line such as _________ or a network

A

hierarchy

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

An ___________ hides details to make a concept easier to manage

A

abstraction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

A collection is an abstraction that defines the
_____________ operations through which the
user can manage the objects in the collection.

A

interface

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

The interface hides (_______________) the object’s data and the implementation of the
operations.

A

encapsulates

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

A
_________________ is a group of values and the operations defined on those values.

A

data type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
A __________________________ is the set of programming constructs and techniques used to implement a collection.
data structure
25
An _______________________________ (ADT) is a data type that is not pre-defined in the programming language.
abstract data type
26
A class that uses a collection interacts with it through a particular _______________
interface
27
The various classes provided with Java are referred to as the _____________ (Application Programming Interface). The subset of those classes that support collections is called the ______________________ .
Java API; Java Collections API
28
A _________ is a linear collection whose elements are added in a ________________ (LIFO
stack; last in, first out
29
One of the principal uses of a stack in computing is to ___________ the order of something.
reverse
30
These are the classic stack operations: _______, _______, _______, __________, _______
push, pop, peek, isEmpty, size
31
_____________________ indicates whether a particular assignment of an object to a reference is lega
type compatability
32
Java provides compile-time __________________ that will flag any invalid assignment.
type checking
33
_________________ can be used to create a class hierarchy where a reference variable can be used to point to any object related to it by ________ relationship.
Inheritance; is-a
34
A __________________________ is a reference variable that can refer to _____________ types of objects at different points in time.
polymorphic reference; different
35
Java enables us to define a class based on a _________ type, that is, we can define a class so that it stores, operates on, and manages objects whose type is _____ specified until the class is _________________ .
generic type; not; instantiated
36
Suppose we define a stack that holds Object references, which would allow it to hold any object, we can define that class to store a __________________ .
generic type T
37
The type is referred to ________________ in the class, and the specific type is specified only when an object of that class is created.
generically
38
The generic type placeholder is specified in ___________________ in the class header:
angle brackets
39
For our conversion, we’ll use an algorithm called _______________________ that uses a __________ to keep track of the binary digits.
"divide by 2"; stack
40
A ________________________ is written with the operator ___________ the two operands instead of between them.
postfix expression; following
41
Postfix expressions eliminate the need for ____________ to specify the order of operations.
parenthesis
42
Both examples use the ______________________ class, which has been part of the Java collections API.
java.util.Stack
43
Javadoc comments begin with ______ and end with ______
/** */
44
Specific Javadoc tags, which begin with _____, are used to identify particular information.
@
45
A Java ____________ provides a formal mechanism for defining the set of operations for any collection.
interface
46
A Java interface defines a set of __________ methods, specifying each method’s _________ but not its body.
abstract; signature
47
A ________ that implements an interface provides _____________ for the methods defined in the interface.
class; definitions
48
The number of cells in an array is called its ____________ .
capacity
49
To _____________ the capacity of the stack, we'll create a new (larger) array and copy over the elements.
expand
50
An integer called _______ will indicate where the top of the stack is, as well as how many elements are in the stack currently.
top
51
You cannot instantiate an array of a generic type directly. Instead, create an array of ___________ references and cast them to the generic type.
objects
52
An _____________ is an object that defines an unusual or erroneous situation.
exception
53
An exception is ___________ by a program, and it can be caught and handled appropriately.
thrown
54
An ________________________________ is thrown when pop or peek is attempted, and the stack is empty.
EmptyCollectionException
55
It is defined to extend _________________
RuntimeException
56
An ________________ to array-based implementations are linked structures.
alternative
57
A ___________________ uses object references to create ________ between objects.
linked structure; links
58
There are ____________ values built into linked lists.
no index
59
To access each node in the list, you must __________ the references from one node to the next.
follow
60
Care must be taken to maintain the ___________ of the links.
integrity
61
To _________ a node at the ________ of the list, first point the new node to the front node, then reassign the front reference.
insert; front
62
To _________ the first node, reassign the front reference accordingly.
delete
63
If the deleted node is needed elsewhere, a reference to it must be established ______ reassigning the front pointer.
before
64
There are many _____________ on the basic linked list concept.
variations
65
For example, we could create a doubly-linked list with _______ and ___________ references in each node and a separate pointer to the rear of the list.
next; previous
66
A separate ______________ class forms the list and holds a reference to the element stored.
LinearNode
67
Our _____________ class stores a generic type T and implements the same _____________ interface used previously.
LinkedStack; StackADT
68
An integer ________ will store how many elements are currently in the stack.
count