CS basics Flashcards
What does big O notation do?
Describe performance of an algorithm, meaning the cost in relation to input
Big O O(1)
Constant time (eg printing the first item in array)
Big O O(n)
Linear time - grows 1:1 with growth of input (eg printing all items in array)
Big O O(n2)
Quadratic time (eg nested loops)
Big O O(log n)
Logaritmic time (binary search, very scaleable)
Big O O(2n)
Exponential time (avoid at all cost)
Arity
Antal argument i en funktion
Interpreters translate…
Line by line
Compilers translate…
All lines and execute the whole program
Vad är HMR (Hot Module Replacement) ?
En funktion som tillåter snabbare iterationer genom att ersätta, lägga till eller ta bort moduler i en applikation utan att behöva ladda om hela sidan eller förlora tillstånd.
What does ‘binary’ mean?
‘Of two states’ eg on/off or 1/0
How big is one binary number?
1 bit
How many values can be represented with 8-bit numbers?
0 -255 (256)
How big is 8 bits?
1 byte
How many values can be represented with 32 bits?
Just under 4.3 billion
How are numbers used to represent letters in binary?
UTF (8 or 16)
Where do computers calculate?
In the ALU
ALU
Arithmetic and Logic Unit
UTF
Unicode Transformation Format
How are values stored in memory?
Registers & RAM
RAM
Random Access Memory
How long does a value stay in RAM?
As long as the power stays on (or it isn’t needed anymore)
CPU
Central processing unit
What does the CPU do?
Executes programs, ie series or collections of instructions
How does the CPU execute programs?
Via Fetch/decode/execute cycle
What is clock speed?
How fast a CPU can perform one fetch/decode/execute cycle
What unit is clock speed measured in?
Gigahertz, billions of CPU-cycles every second.
What’s the small piece of RAM installed on the CPU called?
Cache
Why do we need a cache?
Because data needs to travel between CPU and RAM it’s faster to check first if we already have the value stored in cache.
Cache hit
Data found in cache
Cache miss
Data not found in cache
What can multi-core processors do?
Run multiple streams of instructions at once - but sharing cache for example so the cores can work together
What is the native language of computers?
Raw binary.
What do assemblers do?
Read instructions written in assembly code and translate them to binary.
What are assembly languages?
Low level programming languages that map 1:1 to machine instructions.
High level languages are fed through …
A compiler
What are the three parts of computer science?
- Theoretical computer science
- Computer engineering
- Applications/software engineering
What is the stack?
Short-term memory for currently executing functions. Gets overwritten all the time.
What’s the heap?
Long-term memory, needs to be allocated and freed or your program will have a memory leak and start running very slow.
Stack and/or heap overflow?
Too much memory is used and the stack and the heap start clashing.
What can cause stack overflow?
Infinte loops, recursive calls.
What’s the first thing that happens when we type in a url in the browser?
Request is sent to ISP - ISP asks DNS what IP to go to.
ISP
Internet Service Provider
What happens when ISP ask DNS about IP address?
IP address is sent to ISP and returned to browser.
What happens when IP address is returned from DNS to ISP to browser?
Browser sends request to the IP address directly
What happens when the browser sends request to IP address?
Server at IP address either rejects or responds and sends html, css and js files
What happens when the browser recieves a server response?
The browser renders the page.
What is the Internet backbone?
Physical cables all over the world
Three basic ways to improve web performance?
- Make sure physical distance from servers is small
- As few trips as possible
- As small files as possible
What is WWW?
A shared language between computers that works on top of the internet.
What are 5 expectations of a junior developer?
- Know the basic stack
- Basic git
- Actively seeking to learn
- Persistent with problem solving
- Never afraid to ask questions -nothing is dumb
“Your code will always … , may as well …”
“Your code will always suck, may as well have fun”
“You will never …, but that’s ok”
“You will never know enough, but that’s ok”
“You will never be a master but…”
“You will never be a master but being a student is so much better”
QDD
Question Driven Development