Veda Bites are swipeable micro-lessons — each one teaches exactly one
idea. The bites below come from this kit — swipe through them in the app.
💡 Key Idea
Data Structures: The Foundation
Organize data for efficiency.
A data structure is a way to store and organize data so that operations like insertion, deletion, and searching can be done efficiently. Linear structures (arrays, linked lists, stacks, queues) arrange elements sequentially, while non-linear structures (trees, graphs) arrange them hierarchically or in netwo…
↳ Data structures are the blueprint for efficient data management.
⭐ Important Fact
Time and Space Complexity
Measure algorithm efficiency.
Time complexity measures how runtime grows with input size ($n$), while space complexity measures memory usage. They are expressed using asymptotic notations like Big O, Omega (Ω), and Theta (Θ).
↳ Complexity analysis predicts performance as input scales.
📖 Definition
Big O, Omega, and Theta
Three bounds of growth.
Big O (O) gives the worst-case upper bound. Omega (Ω) gives the best-case lower bound. Theta (Θ) gives a tight bound when both O and Ω match.
↳ Big O for worst, Omega for best, Theta for exact growth.
⚖️ Comparison
Linear vs Binary Search
Sequential vs divide-and-conquer.
↳ Binary search is faster but requires sorted data.
⚙️ Process
Binary Search Algorithm
Halve the search space.
↳ Binary search repeatedly halves the range to find an element.
💡 Key Idea
Stack: LIFO Principle
Last in, first out.
A stack follows LIFO (Last In, First Out). Main operations: push (add to top), pop (remove from top), and peek (view top without removal). Applications include function calls, expression evaluation, and undo operations.
↳ Stack operations are constant time and LIFO-based.
⚙️ Process
Infix to Postfix Conversion
Use precedence and stack.
Convert an infix expression (e.g., A+B*C) to postfix (ABC*+) using operator precedence and associativity.
↳ Postfix eliminates parentheses and simplifies evaluation.
💡 Key Idea
Queue: FIFO Principle
First in, first out.
A queue follows FIFO (First In, First Out). Operations: enqueue (add to rear) and dequeue (remove from front). Variants: circular queue (reuses space), priority queue (elements have priority).
↳ Queues manage data in order of arrival.
⚖️ Comparison
Stack vs Queue
LIFO vs FIFO.
↳ Stack reverses order; queue preserves order.
💡 Key Idea
Singly Linked List Basics
Nodes linked linearly.
A singly linked list consists of nodes, each with data and a pointer to the next node. Traversal goes one direction. Insertion and deletion are efficient if you have the pointer, but access is sequential.
↳ Linked lists allow dynamic memory but no random access.
⚖️ Comparison
Singly vs Doubly Linked List
One pointer vs two.
↳ Doubly lists are more flexible but use more memory.
💡 Key Idea
Binary Tree Traversals
Visit nodes systematically.
Preorder (root, left, right), Inorder (left, root, right), Postorder (left, right, root). Inorder of a BST gives sorted order.
↳ Traversal order determines the sequence of node visits.
💡 Key Idea
Binary Search Tree (BST)
Sorted structure for fast search.
A BST is a binary tree where left child < parent < right child. Operations: insertion, deletion, and searching average O(log n) for balanced trees.
↳ BST enables efficient sorted data operations.
💡 Key Idea
AVL Tree Rotations
Balance the tree.
An AVL tree is a self-balancing BST. When imbalance occurs, rotations fix it: LL, RR, LR, RL. Each rotation maintains BST property and balances height.
↳ Rotations keep AVL height O(log n).
⚖️ Comparison
B Tree vs B+ Tree
Multi-way search trees.
↳ B+ tree has all data in leaves, enabling faster range queries.
⚖️ Comparison
Sorting Algorithms Complexity
Know the best and worst.
↳ Merge and Heap are stable O(n log n) worst-case; Quick is fast but risky.
⚙️ Process
Quick Sort Steps
Partition and conquer.
↳ Quick sort is efficient on average but O(n²) in worst case.
⚙️ Process
Merge Sort Steps
Divide, conquer, merge.
↳ Merge sort guarantees O(n log n) but uses extra space.
💡 Key Idea
Hashing Fundamentals
Direct access via keys.
Hashing maps keys to indices using a hash function. It enables O(1) average search, insert, delete. Collisions occur when two keys map to same index; resolved by chaining or open addressing.
↳ Hashing provides near-constant-time operations with good hash functions.
⚖️ Comparison
BFS vs DFS
Level order vs depth first.
↳ BFS finds shortest path in unweighted graphs; DFS uses less memory on sparse graphs.