

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


2 1. Programming Paradigms 3 4 Procedural: Based on the concept of procedure calls (functions/routines). Focuses on step-by-step instructions (e.g., C, Pascal). 5 Object-Oriented (OOP): Organizes software design around Objects (data) and Methods (behavior). 6 4 Pillars: Encapsulation (hiding internal state), Abstraction (showing only essentials), Inheritance (child classes inherit parent traits), Polymorphism (same interface, different implementations). 7 Functional (FP): Treats computation as the evaluation of mathematical functions. Avoids changing-state and mutable data. Focuses on pure functions and higher-order functions (e.g., Haskell, Lisp, modern JS/Python). 8 Declarative vs. Imperative: Imperative tells the computer how to do it (C, Java). Declarative tells the computer what result you want (SQL, HTML, Functional Programming). 9 10 2. Data Structures (The "Containers") 11 12 Arrays: Contiguous memory. Fast access O(1)O(1) 13 O(1), slow insertion/deletion O(n)O(n) 14 O(n). 15 Linked Lists: Nodes pointing to the next. Fast insertion/deletion O(1)O(1) 16 O(1), slow access O(n)O(n) 17 O(n). 18 Stacks: LIFO (Last-In, First-Out). Used for function call stacks, undo mechanisms. 19 Queues: FIFO (First-In, First-Out). Used for task scheduling, BFS. 20 Hash Tables: Key-value pairs. Average O(1)O(1) 21 O(1) lookups. Collisions handled via chaining or open addressing. 22 Trees: Hierarchical. Binary Search Trees (BST) allow O(logn)O(\log n) 23 O(logn) search/insert if balanced. 24 Graphs: Nodes (vertices) and edges. Used for networks, maps, social connections. Represented via Adjacency Matrix or Adjacency List. 25 26 3. Algorithms & Big O Notation (Complexity) 27 Big O describes the worst-case time or space complexity as input size (nn 28 n) grows. 29 30 O(1)O(1) 31 O(1): Constant (Hash table lookup). 32 O(logn)O(\log n) 33 O(logn): Logarithmic (Binary search). 34 O(n)O(n) 35 O(n): Linear (Simple loop through an array). 36 O(nlogn)O(n \log n) 37 O(nlogn): Linearithmic (Efficient sorting like Merge Sort, Quick Sort). 38 O(n2)O(n^2) 39 O(n2): Quadratic (Nested loops, Bubble sort). 40 O(2n)O(2^n) 41 O(2n): Exponential (Recursive Fibonacci, brute-forcing subsets). 42 43 4. Software Engineering Principles 44 45 SOLID (OOP Design): 46 Single Responsibility: A class should have one reason to change. 47 Open/Closed: Open for extension, closed for modification. 48 Liskov Substitution: Subclasses must be substitutable for base classes. 49 Interface Segregation: Many specific interfaces are better than one general one. 50 Dependency Inversion: Depend on abstractions, not concretions. 51 DRY: Don't Repeat Yourself. 52 KISS: Keep It Simple, Stupid. 53 Testing: Unit (individual functions), Integration (modules working together), System (end-to-end). 54 55 ใ PART 2: SYSTEMS ARCHITECTURE 56 1. The Von Neumann Architecture 57 The foundational model for most modern computers. It consists of: 58 59 CPU (Central Processing Unit):
60 ALU (Arithmetic Logic Unit): Performs math and logic operations. 61 CU (Control Unit): Directs the flow of data and instructions. 62 Registers: Tiny, ultra-fast memory inside the CPU (e.g., Program Counter, Instruction Register). 63 Memory (RAM): Stores data and instructions currently in use. 64 I/O Mechanisms: Interfaces for peripherals (disk, network, display). 65 System Bus: The communication highway (Data Bus, Address Bus, Control Bus). 66 67 2. The Memory Hierarchy 68 Designed to balance Speed, Cost, and Capacity. 69 70 Registers: Fastest, smallest, inside CPU. 71 Cache (L1, L2, L3): Very fast, small. Stores frequently accessed RAM data. Locality of Reference (Spatial and Temporal) makes caches effective. 72 Main Memory (RAM): Fast, volatile (loses data when power is off). 73 Secondary Storage (SSD/HDD): Slower, non-volatile, massive capacity. 74 Tertiary/Off-line Storage: Tape drives, cold cloud storage. 75 76 3. Instruction Set Architecture (ISA) & Execution 77 78 ISA: The abstract model that defines how software controls the processor (e.g., x for Intel/AMD, ARM for mobile/Apple Silicon). 79 CISC vs. RISC: 80 CISC (Complex): Many specialized instructions, hardware does the heavy lifting (x86). 81 RISC (Reduced): Fewer, simpler instructions, software/compiler does the heavy lifting (ARM). 82 The Instruction Cycle: Fetch โ\rightarrow 83 โ Decode โ\rightarrow 84 โ Execute โ\rightarrow 85 โ Memory Access โ\rightarrow 86 โ Write Back. 87 Pipelining: Overlapping instructions in the execution cycle (like an assembly line) to increase throughput. 88 89 4. Concurrency & Parallelism 90 91 Concurrency: Dealing with multiple things at once (Interleaving tasks on a single core). 92 Parallelism: Doing multiple things at once (Executing tasks simultaneously on multiple cores). 93 Amdahlโs Law: The theoretical speedup of a task is limited by its sequential (non-parallelizable) portion. 94 Modern Architecture: Use of GPUs (massive parallelism for graphics/AI) and TPUs/NPUs (specialized AI accelerators). 95 96 PART 3: CORE COMPUTER SCIENCE SUMMARIES 97 1. Operating Systems (OS) 98 The OS manages hardware and provides services to applications. 99 100 Processes vs. Threads: A process is an executing program (has its own memory space). A thread is a lightweight sequence of instructions within a process (shares memory with other threads in the same process). 101 CPU Scheduling: Algorithms to decide which process runs next (First-Come First-Serve, Shortest Job First, Round Robin, Priority). 102 Virtual Memory: Uses the hard drive to simulate extra RAM. Allows running programs larger than physical memory via Paging and Swapping. 103 Deadlocks: A situation where processes are stuck waiting for each other. Requires 4 conditions: Mutual Exclusion, Hold & Wait, No Preemption, Circular Wait. 104 105 2. Computer Networking 106 107 OSI Model (7 Layers): Physical, Data Link, Network, Transport, Session, Presentation, Application. (Mnemonic: Please Do Not Throw Sausage Pizza Away). 108 TCP/IP Model (4 Layers): Network Access, Internet, Transport, Application. 109 TCP vs. UDP: 110 TCP: Connection-oriented, reliable, guarantees delivery and order (Web, Email). 111 UDP: Connectionless, unreliable, fast, no guarantees (Video streaming, Gaming, DNS).