1/61
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
|---|
No study sessions yet.
Function Specification
Tells WHAT a function does (its purpose), but not HOW it does it.
Precondition
What must be TRUE BEFORE the function is called. The "rules" for using it.
Postcondition
What is TRUE AFTER the function finishes. The "promise" it keeps.
Side Effects
Functions should not produce undocumented side effects
abstract data type (ADT)
type (or class) for objects with behavior defined by a set of values and a set of operations.
o(1)
constant time - instant
o(log n)
logarithmic - very slow growth
o(n)
linear - doubles when n doubles
o(n²)
quadratic - 4x time when n doubles
o(2^n)
exponential - time doubles when n increases by 1
Container Class
Class that holds collections of objects
LIFO operations
push(): Add to top
pop(): Remove from top
top(): Examine top element
Applications: Function calls, expression evaluation
FIFO operations
enqueue(): Add to back
dequeue(): Remove from front
front(): Examine front element
Applications: Resource sharing, simulations