Unit 4 Flashcards
Identify inputs and outputs required in a solution
Cycle: Input; Processing; Output; Feedback
Sequential
Following in logical orders/sequences
Preconditions
Constrains the state of a system before the next sector of code starts
Post conditions
Conditions after code has been executed
What to do if there’s an exception?
Inform developer; then crash
What to do if there’s an error?
Inform user; but keep running
Concurrent
When two or more processes are using the same resources at the same time
Describe how concurrent processing can be used to solve a problem
Increases: Computation speed; Complexity of programming language and hardware. Reduces: Complexity of array operations within loops; matrix multiplication/ sorting/ merging files. I(CS; CPL; H) R(CAOL; MM; S; MF)
How do you evaluate the decision to use concurrent processing in solving a problem?
Saved or wasted time? Saved or spent money? Physically possible? Consequence of not doing it?
Advantages of concurrency
Time Cost
Disadvantages of concurrency
May get in each others way Harder to supervise
Abstraction
Removing characteristics from something in order to reduce it to a set of essential characteristics. It’s a technique for managing complexity.
Why is abstraction required?
Reduces complexity; enables concentration on essential; ignores distracting details and essential to problem solving.
How to distinguish between real and abstract?
DETAILS
IB assumptions about collections are
Unordered lists Unknown length
Operations (5 PseudoCode operations)
.addItem() .resetNext() .hasNext() .getNext() .isEmpty()
.addItem()
Adds an item to the collection
.resetNext()
Starts at the beginning of the collection
.hasNext()
To see if it has another item
.getNext()
retrieves next data point from collection
.isEmpty()
Checks whether its empty
Most efficient search algorithm?
Binary; Olog(N) notation; only works on sorted lists
Sequential search
Slower; O(N) notation