Skip to content

Latest commit

 

History

History
executable file
·
84 lines (61 loc) · 2.07 KB

CS50.md

File metadata and controls

executable file
·
84 lines (61 loc) · 2.07 KB

CS50

Binary, C

  • it's about Problem Solving

  • Programming is a tool for Problem Solving

  • Input => Algorithms => Output

  • Decimal System: 101 => 1*100 + 0*10 + 1*1 = 101

  • Binary System: 101 => 1*2^2 + 0*2^1 + 1*2^0 = 5 (in decimal)

  • Transistors On/Off for Binary System

  • Mapping: ASCII for Letters => Unicode

  • Algorithms: Recipes to do something

  • first write in Pseudocode

  • later translate into real code

  • Source Code => Compiler => Machine Code

  • use the Debugger!

Algorithms, Memory

  • Plaintext + Key => Ciphertext

  • Ciphertext + Key => Plaintext

  • Memory = like Lockers => PC has to look into it first

  • sorted vs. unsorted

  • Big O Notation:

    • constant: c
    • logarithmic: log n - binary search in sorted list
    • linear: n - linear search
    • linearithmic: n log n - merge sort
    • quadratic: n^2 - bubble, selection, insert sort
    • exponential: c^n - travelling salesman (dynamic programming)
    • factorial: n! - travelling salesman (brute force)
  • Linear Search: one for one, from left to right: O(n)

  • Binary Search: search in the middle, half it every time: O(log n)

  • Insertion Sort: insert into right spot on sorted side

  • Selection Sort: select the smallest number

  • Bubble Sort: bubbling highest number up: O(n^2)

  • Merge Sort: Left Half, Right Half, Merge: O(n log n)

  • Recursion: Function calls itself until basecase

  • Heap, Stack

  • Garbage Values: old functions from the Stack

  • Pointer, Pointee, Assignment

  • char *, malloc

  • Hexadecimal: 0-f, 2 blocks of 2^4 bits => decimal: 255 => binary: 1111 1111 => hexa: 0x ff

Data Structures

  • struct to create new data structure
  • Linked List for dynamic memory allocation
  • Stack: LIFO
  • Queue: FIFO
  • Tree
  • Hash Table: Array with Linked List
  • Trie: constant time

HTTP

  • set of conventions for communication
  • Routing, TCP, IP
  • Server: piece of software, that listens for http requests and responds to them
  • 192.168.2.1:80 => IP and TCP Port

Python

  • Source Code => Compiler => Byte Code => Interpreter
  • named paramters/arguments
  • no more pointers
  • for in loop
  • Flask as web microframework