Is divide andconquer the ffaasstteesstt wwaayy,, aallll
tthhee ttiimmee,, ooff sseeaarrcchhiinngg ffoorr aa nnuummbbeerr iinn aa lliisstt
??
11 Linear Search ?
22
33
110000
Binary Search ?
Suppose they are Random
Suppose they are Ordered
Suppose they are mixed-up
EExxaammppllee 22
vvooiiddff (( iinntt xx [[ ]] ,, iinntt aarrrraayySSiizzee ))
{{
iinntt ii ;;
ffoorr (( ii == 00 ;; ii << aarrrraayySSiizzee ;; ii ++++))
xx [[ ii ]] == ii ;;
}}