test 1 - comp 228

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

1/59

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.

60 Terms

1
New cards

an abstract data type is...

set of values
set of operations that can be performed by these values
specific representation in memory

2
New cards

ADT Logical Level

The use of an ADT to solve a problem. Applicationcode that uses an ADT only needs to know how tocreate instances of the ADT and invoke its operations.

3
New cards

Interface Level

The set of operations that can be used at the logical level to add, remove and access the data maintained in an ADT.

4
New cards

Implementation Level

A specific representation of the data in memory and code that implements the ADT operations

5
New cards

two ways to use the term data structure

any collection of data organized is some fashion, the underlying data structure for a specific ADT implementation

6
New cards

big o bluf

bottom line up front

7
New cards

Big O Notation

gauge how long it takes to execute the algorithms we develop for operations, especially went considering alternative algorithms for a given operation

8
New cards

o(1)

bounded time (good) = execution time essentially the same regardless of how much is processed

9
New cards

o(log2N)

Logarithmic time; each step of the algorithm cuts the amount of work left in half

10
New cards

O(N)

linear time - a loop that is used that potentially processes each of the data elements

11
New cards

O(N log2 N)

n log n time - will do in a pinch some combination of divide and conquer with non-nested loop

12
New cards

O(N^2)

quadratic time - avoid - the nested loop structure is used

13
New cards

tretan

always starts by guessing 1 and adds 1 to his previous guess

14
New cards

Peleg

divides and conquers - start by guessing, 50 and guesses the middle of remaining range after eliminating numbers based on feedback

15
New cards

omega(f(n))

lower bound on execution time to execute an algorithm - best case

16
New cards

O(f(n))

worst case, f(n) an upper bound

17
New cards

Theta(f(n))

average - the time to execute an algorithm but also used for average

18
New cards

WHICH ASSESSMENT WILL BE THE MAIN DRIVER IN DECIDING BETWEEN TWO OR MORE ALGORITHMS THAT CAN BE USED FOR AN ADT OPERATION

big o

19
New cards

how to measure the time complexity of an algorithm

we count the number of basic operations required to complete the algorithm

20
New cards

Collection

An object that holds other objects.Typically we are interested in inserting, removing,and iterating through the contents of a collection

21
New cards

What is generics?

the capability to parameterize types.

22
New cards

What is the key benefit of generics?

to enable errors to be detected at compile time rather than at runtime.

23
New cards

generic class or method

permits you to specify allowable types of objects that the class or method may work with

24
New cards

Generic type

A placeholder for an object type that is not made concrete until the class that refers to it is instantiated. It represents any data type, not exclusive to string or int.

25
New cards

An ADT implementation is a class

that has a public method for each of theADT's operations

26
New cards

Java interface

used to to specify the methods that implement an ADT's operations and these methods are called by application-level code that uses our ADT class

27
New cards

A Java interface is similar to an abstract class

but we implement an interface vs. extendingan abstract superclass

28
New cards

A Java interface can include

abstract method signatures
static methods
default methods
constants
public abstract are default modifiers for methods

29
New cards

A Java interface doesn't include

instance variables:
public static final are the default, and only, modifiers for all attributes

30
New cards

What are references?

Are memory addresses

31
New cards

References are sometimes referred to...

links, addresses, or pointers

32
New cards

A variable of a reference type holds...

the address of the memory location that holds the value of the variable, rather than the value itself

33
New cards

sorted list

placed in a particular order

34
New cards

indexed list

A list in which each element has an index value associated with it

35
New cards

list ADT assumptions

lists are unboundedduplicates are allowedno nullsmake list easy to useminimal preconditions

36
New cards

sorted lists are sorted in increasing order defined by

compareTo

37
New cards

indices for indexed lists are

continguous

38
New cards

list iteration

one element at a time, from first element to the last

39
New cards

two versions of get operations

1. getI(element)
2.get(i) - index

40
New cards

Are string lists unbounded?

no, they are bounded

41
New cards

unbounded

limitless

42
New cards

bounded

limited

43
New cards

Does "remove" maintain insertion order?

no

44
New cards

Java interface is similar to an

abstract class

45
New cards

List ADT Operations

add, remove, size, isEmpty, contains, get

46
New cards

An ADT does not have a specific representation in memory but...

an ADT implementation does

47
New cards

HOW DO WE CREATE A LINK LIST?

Use a node object that includes an instance variable that is a reference to a node object

48
New cards

An ADT implementation that uses an array for its underlying data structure is generally considered

BOUNDED

49
New cards

An ADT implementation that uses a linked list for its underlying data structure is generally considered

unbounded

50
New cards

UNDERLYING DATA STRUCTURES FORADT IMPLEMENTATIONS

array and linked list

51
New cards

The maximum number of elements the ADT can hold is

the size of the array

52
New cards

Linked List

A linear data structure, much like an array, that consists of nodes, where each node contains data as well as a link to the next node, but that does not use contiguous memory.

53
New cards

The node object

Each node object holds a data element and has an attribute (instance variable) that is a reference to a node object

54
New cards

The next pointer

The value of a given node's next attribute points to the next node in the chain of nodes

55
New cards

The next in the last node of the chain is

null

56
New cards

The head

a separate reference variable that refers to the first node in the linked list

57
New cards

Any node in the linked list can be accessed by

starting at the head and following the chain of next pointers

58
New cards

The tail

Sometimes a reference to the last node in the linked list is maintained in addition to the head

59
New cards

DOUBLY LINKED LIST

a linked list in which each element has both forward and backward pointers.

60
New cards

helper method

A method of a class that is used by other methods in a class to help complete a task. Helper methods have access level private.