Loops Time Complexity - 2
Duration: 22 min
This video lesson is available to enrolled students.
Inside: a video lesson and guided study material.
Module outline
- Discrete Mathematics: Set Theory, Relations, Functions, Graph Theory, Group Theory, Propositional and Predicate Logic
- DataBase Management System/DBMS: Basics of DBMS, ER Diagram, Relational Model & Functional Dependencies, Keys & Integrity Constraints, Normalization (1NF - BCNF), Decomposition Properties & 4NF, File Organization & Indexing, Relational Algebra, SQL, Relational Calculus, Transaction Management, Concurrency Control
- Digital Electronics: Digital Systems & Boolean Basics, Logic Gates & Hardware, Boolean Expression, Boolean Minimization, Combinational Circuit, Sequential Circuits, Number System, Number Representation
- Computer Architecture: Floating Point Rep, Cache Memory Organization, Input Output Organisation, Pipelining, Instr Formats & Modes, Control Unit Design
- Operating System: Introduction to OS, Process Management, CPU Scheduling, Process Synchronization, Threads & Process Creation, Deadlock, Memory Management, Virtual Memory, Disc Scheduling, File Management
- C Language: C Fundamentals, Control Flow, Functions, Arrays & Pointers, Storage Classes, Structures & Enums, DMA, Macros, Scoping & File Handling
- Data Structures: Introduction to DS, Array, Stack, Queue, Linked List, Tree, Graphs, Hashing
- Algorithms: Algorithm Analysis, Time Complexity Analysis, Sorting Algorithms, Greedy Algorithms, Dynamic Programming, Minimum Spanning Trees, Shortest Path Algos
- Computer Networks: Introduction to CN, DLL: Access Control, DLL: Flow Control, DLL: Error Control, DLL: Framing, Data Link Layer - Ethernet, Net Layer: IPv4 & Proto, Net Layer: IP Addressing, Net Layer:Routing Protocol, Transport Layer Services, TL: Congestion & UDP, Application Layer, Hardware Basics
- Theory Of Computation/Automata Theory: Introduction to TOC, Deterministic FA (DFA), Non-Deterministic FA, Regular Expressions, Grammar, Regular Language Properties, Moore & Mealy Machines, Pushdown Automata & CFG, Turing Machines, Complexity Theory
- Compiler Design: Intro to Compilers, Lexical Analysis, Grammar & CFG, Syntax Analysis: Top-Down, Syntax Analysis: Bottom-Up, Semantic Analysis & SDT, Intermediate Code Gen, Code Optimization, Run Time Environment
- Engineering Mathematics: Permutation and Combination, Linear Algebra, Calculus, Probability, Statistics
- General Aptitude: Ratio and Proportion (Ratios), Divisibility Rules, Data Interpretation, Logarithm, Number System, HCF LCM, Sequence and Series (Series), Speed Time and Distance, Series (Number and Letter Series) (Numerical Relations and Reasoning), Coding Decoding, Data Sufficiency, Non Verbal Reasoning (Spatial Aptitude) (Spatial Reasoning) (Visual Reasoning), Percentage, Mensuration and Geometry, Mental Ability, Arithmetic, Profit and Loss, Powers and Exponents (Surds and Indices), Average, Deductive and Inductive Reasoning (Logical Deduction and Induction) (Prepositional Reasoning), Syllogisms, Venn Diagram, Seating Arrangements, Blood Relations, Directions (Direction Test), Analogy, Algebra, Time and Work, Analytical Reasoning (Counting Figures Reasoning), Puzzle Solving (Puzzles), Cubes & Dices, Ranking, Order and Sequence, Mixture and Alligation, Age Problems, Clock, Selection Decision Table (Decision Making), Data Arrangement
- English (Verbal Aptitude): Vocabulary, Noun, Subject Verb Agreement (Verb Noun Agreement), Adjectives, Tenses, Pronoun, Preposition, Direct and Indirect Speech, Sentence Re-arrangements (Para Jumbles) (Narrative Sequencing), Sentence Completion (Fill in the blanks), Comprehension / Reading Comprehension / Unseen Passages (Critical Reasoning) (Paragraph Questions), Sentence Correction (Error Correction), Verbal Analogy (Word Based Analogy), Conjunction, Interjection, Verb, Articles, Adverb, Modals, Sentence Construction
- Live Classes Recordings(Earlier Batch): GATE 2026 Live Class
- Full Mock Test:
- Previous Year Papers:
- GATE 2026 Counselling: Counselling and Guidance Sessions
AI summary & chapters
AI Summary
An AI-generated summary of this video lecture.
This lecture segment focuses on analyzing the time complexity of for loops with non-standard increment steps, specifically examining arithmetic progressions where the loop variable increases by a constant value greater than one. The instructor systematically derives iteration counts for loops incrementing by 3 and then by 10, demonstrating that constant increments result in linear time complexity O(n). The teaching flow moves from manual tracing of loop variable values to algebraic derivation of the general term, and finally to Big O simplification. Key concepts include setting up inequalities based on loop conditions, solving for the number of iterations k, and understanding that constant factors in arithmetic progressions do not affect asymptotic complexity. The instructor uses board writing to visualize the sequence of values taken by the loop variable i, explicitly showing terms like 1 + k*step and comparing them against the upper bound n. This approach reinforces the method for determining loop bounds when increments are not unity.
Chapters
0:00 – 2:00 00:00-02:00
The video begins with an introduction to loop complexity analysis, though specific content is not fully visible in the initial sampled screenshots. The segment likely sets up the context for analyzing loops with non-standard increments, preparing students to trace execution manually. Evidence suggests early focus on foundational concepts before diving into specific arithmetic progression examples.
2:00 – 5:00 02:00-05:00
The instructor analyzes a for loop with increment step 3, writing the code 'for(i = 1; i <= n; i = i + 3)' on the board. He manually traces variable 'i' values as 1, 1+3, 1+2*3, comparing each against the condition 'n'. The instructor circles sequences and marks iteration counts (1, 2, 3...) to demonstrate how the loop progresses. This manual tracing establishes the pattern needed for algebraic derivation, showing that each iteration adds 3 to the previous value.
5:00 – 10:00 05:00-10:00
Building on the manual trace, the instructor derives the general term for loop variable 'i' as '1 + k*3', where k represents the iteration index. He sets up the inequality '1 + k*3 <= n' to solve for the maximum value of k before termination. The derivation concludes that the loop runs approximately (n+1)/3 times, explicitly writing '(k+1) Times' to indicate total iterations. This algebraic step transforms the visual pattern into a mathematical formula for iteration count.
10:00 – 15:00 10:00-15:00
The instructor simplifies the derived iteration count to determine Big O complexity. He explains that since (n+1)/3 involves a constant divisor, the time complexity simplifies to O(n). The board shows 'TC = [(n-1)/3] + 1' leading to the conclusion that constant factors are dropped in asymptotic notation. This segment reinforces that linear arithmetic progressions, regardless of step size, maintain linear time complexity.
15:00 – 20:00 15:00-20:00
A new example is introduced with increment step 10, written as 'for(i = 1; i <= n; i = i + 10)'. The instructor repeats the tracing method, listing values 'i = 1', 'i = 1 + 1*10', 'i = 1 + 2*10' and checking conditions against n. He numbers iterations sequentially (1, 2, 3...) to show the progression. This repetition solidifies the method for handling different constant increments while maintaining the same analytical approach.
20:00 – 22:19 20:00-22:19
The instructor completes the analysis for the increment-by-10 loop, deriving 'k <= (n-1)/10' and calculating total complexity as TC = [(n-1)/10] + 1. He concludes with '= Theta(n)' on the board, confirming that constant increments yield linear complexity. The final visible text includes 'i <= n; i = i + 1000', suggesting a generalization to even larger steps. The segment ends by reinforcing that any constant step size results in O(n) time complexity.
The lecture demonstrates a consistent methodology for analyzing loop time complexity when increments are constant values greater than one. The instructor first manually traces the loop variable to establish a pattern, then derives an algebraic formula for iteration count using arithmetic progression principles. Key evidence includes board writing of inequalities like '1 + k*3 <= n' and explicit iteration counts such as '(k+1) Times'. The critical insight is that while the exact number of iterations depends on the step size (e.g., n/3 vs n/10), the asymptotic complexity remains O(n) because constant factors are ignored in Big O notation. This approach applies universally to any loop with a fixed increment, providing students with a reliable framework for complexity analysis.