# BUFFER — CODE1161_wk03

Week 2.5 technically. So far so good. Already understanding the concept of how to use the terminal, python languages, and git hub.

### EXTRA COMMANDS AND SHORT-CUTS

GIT HUB

HOW TO COMMIT GIT
`git status` (to check which one files you made changes to)
`git add filename` (eg. git add week2/exercise3.py)
`git commit -m “enter message on what you edited”`
`git push` (pushes back the file u edited to your github.com or remote)
REMEMBER TO COMMIT EVERY TIME AFTER MAKING AN EDIT, AND THE EDIT WORKS.

remote = github.com
`git log` (checks your logs/messages/pushed files)
`q` (to exit git log, or exit anything on terminal where the bottom of the page has “:”)
`git reset` to un-stage your file
`git pull` to pull a file from the remote

### 17 March 2017 — TUTORIAL

KhanAcademy — Intro to Algorithms, Binary Search and Asymptotic Action

Intro to Algorithms
Finding the number the computer chosen was a walk in the park since I watched this Ted-Ed video on Youtube before. Although it’s not exactly the same thing as choosing a single number, it tells you how a sort algorithm works.

In case you want to know what video I watched,

Binary Search
Finding a number in a list is called binary search. I hate that they used Java Script instead of Python, but here is the summary of how it works: basically you want to half your guess every time to reduce the most possible amount of list. In snek language (Python):

`1 def binarySearch(alist, item):2 first = 03 last = len(alist)-14 found = False5 6 while first<=last and not found:7 midpoint = (first + last)//28 if alist[midpoint] == item:9 found = True10 else:11 if item < alist[midpoint]:12 last = midpoint-113 else:14 first = midpoint+115 16 return found`

Asymptotic Notation
Trying to figure out what the whole thing was about got me feeling like taking a trip here:

This is what I learnt:
1. There are 3 types of Asymptotic Notation: big- θ, big-O, and big-Ω
2. Big-θ = worst case scenario time
3. Big-O = upper bounds
4. Big-Ω = lower bounds
5. Basically, if you want to θ an equation, you need to bring it down to the consonant (not exponential)(can someone confirm this for me?)
eg.
n²+2n-10=n²
n³*3n=n⁴
n+30 = n
6. Just some terms on types of equations (which I totally forgot before I did this):
6a. constant = constant
6b. linear = output increases linearly (eg. 3n or (2/3)n)
6c. polynomial = the exponent is constant (eg. 3ⁿ or (2/3)ⁿ )
6d. exponential = growth of the value of a function is proportional to the function’s current value (a.k.a how I wished my earning will double in amount as my age increases) (boring eg. 1000²ⁿ or (2/3)²ⁿ)

This is what I am still trying to wrap my head around:
1. log and lg (totally forgot about it. last time I saw these equations was 5 years ago)
2. The whole concept around asymptotic notation (can’t you just get the comp to figure it out for you?)