1st 10 Flashcards
capture reusable pieces of design wisdom.
Design patterns
Goals:
Quickly communicate design wisdom to new designers
Give a shared vocabulary to designers
Notation OF LIFO
Insert:
Remove:
The accessible element is called BLANK
PUSH
POP
TOP.
Restricted form of list: Insert and remove only at front of list.
LIFO: Last In, First Out.
Restricted form of list: Insert at one end, remove from the other.
FIFO: First in, First Out
Notation OF FIFO
Insert:
Delete:
First element:
Last element:
Enqueue
Dequeue
Front
Rear
Often want to insert records, delete records, search for records.
Dictionary
Required concepts FOR DICTIONARY
Search key:
Key comparison
Equality:
Relative order:
Describe what we are looking for
Sequential search
sorting
Problem: How do we extract the key from a record?
Can’t just compare records to each other. Need to extract the key.
How? Could have an explicit key field? No. Explicit key method? No. Records can have multiple keys.
Could the key method be type-sensitive? No, multiple fields in the record can have the same type.
There is a fundamental problem: They key is not a property of the record, it is a property of the context in which the record is being used.
Can’t just compare records to each other. Need to extract the key.
How? Could have an explicit key field? No. Explicit key method? No. Records can have multiple keys.
Could the key method be type-sensitive? No, multiple fields in the record can have the same type.
There is a fundamental problem: They key is not a property of the record, it is a property of the context in which the record is being used.
Problem: How do we extract the key from a record?
We will explicitly store the key with the record.
NOTE: Fundamentally, the key is not a property of the record, but of the context.
SORTED VS UNSORTED LIST
If list were blank it Could use binary search to speed search
Would need to insert in order, WHICH would is not time efficient thus slowing insert
Which is better?
If lots of searches, blank list is good
If inserts are as likely as searches, then blank blank
sorted
sorting is no benefit.