Ch 1-4 Data Structures and Algorithms in Java 6th edition

0.0(0)
studied byStudied by 2 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/124

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

125 Terms

1
New cards

method

a function that holds executable statements

2
New cards

identifier

the name of a class, method, or variable

3
New cards

base types (give another name for it as well)

primitive type: commonly used data types such that Java provides them (boolean, char, byte, short, int, long, float, double)

4
New cards

object

the primary actors in java: an instance of a class

5
New cards

class

the type of the object (and a blueprint of the object) that defines what data the object stores and the methods for accessing and modifying that data

6
New cards

2 critical members of a class

instance variables and methods

7
New cards

instance variables (provide its other name)

fields: represent the data associated with an object

8
New cards

accessor method

a method that returns information to the caller without changing any instance variables

9
New cards

update method

a method that may change one or more instance variables when called

10
New cards

default constructor

a zero-parameter constructor

11
New cards

what are the default values for reference variables, boolean variables, and numeric types?

null, false, and 0

12
New cards

"new" operator

returns a reference (memory address) to the newly created instance

13
New cards

a method's signature

a method's name combined with the number and types of its parameters

14
New cards

access control modifiers

modifiers that control the level of access the defining class grants to other classes

15
New cards

"public" modifier

all classes may access the defined aspects

16
New cards

"protected" modifier

access is granted to subclasses and classes belonging to the same package

17
New cards

"private" modifier

access is granted only to the class that defined that member

18
New cards

"static" modifier

variable/method is associated with the class as a whole, rather than with an individual instance

19
New cards

"abstract" modifier

its signature is provided but without implementation of the method body

20
New cards

"final" modifier

can be initialized in the declaration but can never be assigned a new value

21
New cards

the "body" of a method

defines what the method does

22
New cards

compound object

instance variables include all the desired return values, then we merely return a reference to that compound object (as opposed to returning multiple different variables)

23
New cards

"this" keyword

a reference to the instance upon which the method was invoked

24
New cards

"char" - what type and what is it

base type: stores a value that represents a single text character

25
New cards

String

represents a sequence of zero or more characters (immutable and can not be changed once created)

26
New cards

character index

the way to access a character within a string

27
New cards

concatenation

the primary operation for combining strings

28
New cards

StringBuilder

a mutable version of a string

29
New cards

Array

a sequenced collection of variables of the same type

30
New cards

cell (in an array)

a variable

31
New cards

index (in an array)

refers to the value stored in the cell

32
New cards

element (in an array)

the value stored

33
New cards

capacity (in an array)

the length of the array

34
New cards

Enumerated type (enum)

types that are only allowed to take on values that come from a specified set of names

35
New cards

literal (which ones are allowed)

used to directly express a value in an assignment or other expression: boolean (TF), integer, floating point (1.23F), character ('a'), string ("hello")

36
New cards

pre-increment/post-decrement

++var/--var: 1 is added/subtracted and its new value is the result of the subexpression

37
New cards

post-increment/post-decrement

var++/var--: 1 the incoming value of the variable is the result of the subexpression

38
New cards

generalized operator precedence

method/array indexing/dot operator, post/prefix ops & casting, MDAS, comparison, equality, logical and/or, assignments

39
New cards

casting

an operation that allows us to change the type of a value

40
New cards

explicit casting

(type) expression: either from one primitive type to another primitive type or reference to another reference type

41
New cards

widening/narrowing cast

int to a double vs double to an int

42
New cards

implicit casting

copying values from one variable with one type to another variable to another type, or when perfomring arithmetic operations with a mixture of numeric types

43
New cards

if statement

a way to indicate that the next steps of a program depend on the outcome of some testable conditions

44
New cards

switch

multiple-value control flow (commonly used with enum):

45
New cards

while loop

tests a condition and executes the body each time the condition is evaluated to be true

46
New cards

do-while loop

similar to a while loo but the boolean condition is checked at the END of each pass rather than before

47
New cards

for loop

a while loop under a defined iteration of loop

48
New cards

for-each loop

for (ElementType loop_variable : container)

loopBody

49
New cards

break statement

break out of the innermost switch, for, while, or do-while statement body

50
New cards

continue statement

causes the execution to skip over the remaining steps of the current iteration of the loop but then the flow returns to the top of the loop

51
New cards

package

a set of program/data files used to perform a specific task

52
New cards

robust software

capable of handling unexpected inputs not explicitly defined for its application

53
New cards

adaptable software

evolve over time in response to changing conditions in its environment

54
New cards

portable software

ability of software to run with minimal change on different hardware and operating system platforms

55
New cards

software reusability

the same code can be used as a component of different systems in various applications

56
New cards

abstraction

distill a complicated system down to its fundamental parts

57
New cards

Abstract data types (ADT)

a mathematical model of a data structure that specifies the type of data stored, operations supported on them, and types of parameters of the operations

58
New cards

encapsulation

different components of the software system should not reveal the internal details of their respective implementations

59
New cards

modularity

organizational principle in which different components of a software system are divided into separate functional units

60
New cards

design pattern

a solution to a "typical" software design problem

61
New cards

inheritance

allows a new class to be defined based upon an existing class as the starting point

62
New cards

in OOP, what is the existing class (or root) called? 3 names

base class, parent class, superclass

63
New cards

in OOP, what are inherited classes called? 3 names

derived class, child class, subclass class,

64
New cards

what 2 main ways does a subclass differentiate itself from a superclass?

augment (by adding new fields/methods) and/or specialize (override an existing method)

65
New cards

single inheritance

each class can extend exactly one other class

66
New cards

polymorphism

"many forms" - the ability of a reference variable to take different forms

67
New cards

Liskov Substitution Principle

a variable/parameter with a declared type can be assigned an instance from any direct/indirect subclass of that type

68
New cards

dynamic dispatch

deciding at runtime to call the version of the method that is most specific to the actual type of the referenced object (not the declared type)

69
New cards

arithmetic/geometric progression

adding a fixed constant or multiplying by a fixed constant (that fixed constant is a base)

70
New cards

Fibonacci progression

each value of the series is the sum of the two most recent values

71
New cards

strong typing

the types of parameters that are actually passed to methods rigidly conform with the type specified in the interface

72
New cards

interface

the main structural element that enforces an API - a collection of method declarations with no data and no bodies

73
New cards

multiple inheritance

the ability of extending from more than one type (allowed for interfaces but NOT classes)

74
New cards

mixin

a multiple inheritance technique to approximate the multiple inheritance of concrete classes (that other languages have)

75
New cards

abstract class

between a traditional class and an interface: may define abstract methods (signature but no implementation) AND may also define fields and concrete methods

76
New cards

template method pattern

an abstract base class provides a concrete behavior that relies upon calls to other abstract behaviors

77
New cards

catching an exception

handles an exception in an appropriate fashion

78
New cards

what might cause an exception?

unavailable resources, unexpected input from user, logical errors from the programmer, etc

79
New cards

errors: what throws them and what are they?

thrown by the Java Virtual Machine and designate the most serious situations that are unlikely to be recoverable

80
New cards

what is an exception (generally)?

designate situations in which a running program might reasonably be able to recover

81
New cards

the subtypes of WHAT are treated as unchecked exceptions?

RuntimeException

82
New cards

widening conversion (include 3 common cases)

a type T is converted to a wider type U:

- T and U are class types and U is a superclass of T

- T and U are interface types and U is a superinterface of T

- T is a class that implement interface U

83
New cards

narrowing conversion (include 3 common cases)

a type T is converted to a narrower type S

- T and S are class types and S is a subclass of T

- T and U are interface types and S is a subinterface of T

- T is an interface implemented by class S

84
New cards

composition design pattern

a solution in which we create a class whose instances store a pair of values as a single object

85
New cards

why create nested classes?

when defining a class that is strongly affiliated with another class

86
New cards

outer class

the containing class that has a nested class inside of it

87
New cards

formal name of a nested class

OuterName.NestedName

88
New cards

inner class

a non-static nested class

89
New cards

sorting

starts with an unordered array of elements and rearranging them into nondecreasing order

90
New cards

insertion-sort

an algorithm that considers one element at a time and placing the element in the correct order relative to those before it

91
New cards

"stable" sorting algorithm

guarantees that the relative order of two equivalent elements remains the same in the result as in the original sequence

92
New cards

pseudorandom number generator

objects that compute a sequence of numbers that are statistically random: the next number depends on the previous number(s)

93
New cards

seed

a place to start for a pseudorandom number generator

94
New cards

cryptography

the science of secret messages

95
New cards

encryption (in cryptography)

a message (plaintext) is converted into a scrambled message (ciphertext)

96
New cards

decryption (in cryptography)

turning ciphertext back into its original plaintext

97
New cards

plaintext

a message to be received

98
New cards

ciphertext

scrambled message

99
New cards

Caeser cipher

replacing each letter in a message with the letter that is a certain number of letters later in the alphabet

100
New cards

modulo operator

denoted by % in Java: the remainder of the division of two integers