Quarter 1
___
Notes
4.1
Logically
https://docs.google.com/presentation/d/1COqQgcW90ZcwnCIRUqy5vCkskxp2GT
zk2GBkeVlgIJ8/edit?usp=sharing
Ahead
https://docs.google.com/presentation/d/1dywD5bpvU_AWe61n2CQX9ozbT_16L3
X5IHO-kSbcmfk/edit?usp=sharing
Abstractly
https://docs.google.com/presentation/d/1IYR8DW4ulTJtuNfDLgp5IiZXCXCTtiN
NPzokts3gSKU/edit?usp=sharing
Concurrently
https://docs.google.com/presentation/d/1uhgnnEfNFbTIuOoNXSvz0DiSReE0DZt
XIwWzDgu69yM/edit?usp=sharing
,Procedurally
https://docs.google.com/presentation/d/1-E-xtFrkUjHR_vAOUuM7_KLE6MBxieb
QvUhm4u3XMkA/edit?usp=sharing
4.2.1 Algorithms for linear array
● Sequential search
○ For finding an item in a list
○ Just going through each element until it finds a match
● Binary search
○ For finding an item in a sorted list
○ Also known as half-interval search
○ Compare the target to the element in the middle
○ Eliminate lower half if target is higher and opposite for lower
○ List can have duplicate
○ Faster than sequential search
● Bubble sort
○ Compares adjacent items and swap them if they are in the wrong
order then move to the next adjacent items
○ Slow for big list
○ Having one loop through the list without any swaps means the list is
sorted
● Selection sort
, ○ Loop through the list to get the lowest/highest number and swap it
with the current one
○ Repeat for each elements
4.3.1 Fundamental operations
● Fundamental operations of the cpu
○ Add
■ Can be adding two numbers together
■ Can also be adding a number to the CPUs
○ Compare
○ Retrieve (or Load)
○ Store (or Save)
● Conditional instructions
○ And
○ OR
○ XOR
■ Either but not both
○ Neither
4.3.2 Complexity of instructions
● Fundamental instruction vs compound instruction