← Flashcard LibraryComputer Science

Computer Science Flashcards — free to study.

Sample flashcards covering algorithms, data structures, Big O notation, OOP, databases, and system design. Useful for CS exams, coding interviews, and FAANG prep.

AlgorithmsData StructuresBig O NotationOOPDatabasesSystem Design

Study tips for computer science

Implement data structures from scratch at least once — reading code is not the same as writing it.

For algorithms, trace through examples by hand before trying to code them.

Connect concepts: a hash table is just an array + a hash function. Understanding the relationship makes both easier to remember.

Sample cards (12)

Algorithms

What is the time complexity of binary search?

O(log n). Binary search eliminates half the remaining elements with each comparison, so it takes log₂(n) comparisons in the worst case.

Data Structures

What is the difference between a stack and a queue?

Stack: LIFO (Last In, First Out) — like a stack of plates. Operations: push/pop. Queue: FIFO (First In, First Out) — like a line. Operations: enqueue/dequeue.

Big O Notation

What is Big O notation and what does O(n²) mean?

Big O describes an algorithm's worst-case growth rate as input size (n) increases. O(n²) means the time grows quadratically — doubling n quadruples the time. Typical of nested loops.

Data Structures

What is the difference between a linked list and an array?

Array: contiguous memory, O(1) random access, O(n) insertion/deletion. Linked list: non-contiguous nodes with pointers, O(n) access, O(1) insertion/deletion at known position.

Algorithms

What is recursion and what is a base case?

Recursion is when a function calls itself to solve a smaller version of the same problem. A base case is the condition that stops the recursion (prevents infinite calls).

OOP

What are the four pillars of Object-Oriented Programming?

1) Encapsulation: bundling data and methods, hiding internals. 2) Abstraction: exposing only necessary interfaces. 3) Inheritance: classes inherit from parent classes. 4) Polymorphism: same interface, different implementations.

Databases

What is the difference between a primary key and a foreign key in SQL?

Primary key: uniquely identifies each row in a table (cannot be null). Foreign key: a column that references a primary key in another table, establishing a relationship between tables.

Algorithms

What is the difference between depth-first search (DFS) and breadth-first search (BFS)?

DFS: explores as far as possible down each branch before backtracking (uses a stack). BFS: explores all neighbors at the current depth before going deeper (uses a queue). BFS finds shortest path in unweighted graphs.

Data Structures

What is a hash table and what is its average time complexity for lookup?

A hash table stores key-value pairs using a hash function to map keys to array indices. Average case lookup, insertion, and deletion: O(1). Worst case (many collisions): O(n).

Networking

What is the difference between TCP and UDP?

TCP: connection-oriented, reliable, ordered delivery, slower (used for web, email, file transfer). UDP: connectionless, no guarantee of delivery or order, faster (used for video streaming, gaming, DNS).

System Design

What is a REST API?

REST (Representational State Transfer) is an architectural style for APIs using HTTP methods: GET (read), POST (create), PUT/PATCH (update), DELETE (remove). Resources are identified by URLs.

System Design

What is the difference between a process and a thread?

A process is an independent program in execution with its own memory space. A thread is a unit of execution within a process — threads share the process's memory, making communication faster but synchronisation harder.

Studying for a specific CS course or interview?

Upload your course notes, textbook chapters, or a job description. Elly generates targeted flashcards for exactly what you need to know.

Generate from my notes

Made for exam season

Pass that exam.

Turn your notes into flashcards and quizzes in seconds. Study smarter — start free today.