PGoCareerGoCareer prep tools
Home
LoginSign up
  • Java
  • Python
  • AI
  • React
  • Angular
  • PHP
  • Node.js
  • SQL
  • DSA
  • HTML
  • CSS
  • JS
  • Spring
  • ML
  • MongoDB

DSA · Theory

Time Complexity

← All stacks

Theory

336/810

Time Complexity

Asha only reaches for Time Complexity when n vs n² on 10k rows has to stay correct in a viva.

For Time Complexity, a dry-run table is in play. Don’t blame it until you have traced n vs n² on 10k rows.

Time Complexity exists so Asha can keep n vs n² on 10k rows correct in a viva.

Asha ships Time Complexity in a viva. That is the use case worth saying.

Time Complexity trap — saying ‘fast’ with no Big-O. Asha loses marks for that every viva.

After Time Complexity, Asha should still remember saying ‘fast’ with no Big-O.

Close Time Complexity with — “If I skip it, n vs n² on 10k rows goes wrong like this: saying ‘fast’ with no Big-O.”

Exam tip

Board: n vs n² on 10k rows. Dry-run Time Complexity. Name the trap: saying ‘fast’ with no Big-O.

Example

def demo(n):
    # O(1)
    x = n + 1
    # O(n)
    total = sum(range(n))
    # O(n^2)
    pairs = 0
    for i in range(n):
        for j in range(n):
            pairs += 1
    return x, total, pairs

print(demo(3))

Time Complexity — big-O describes how work grows with input size — ignore constants.

Short notes

  • DefTime Complexity — Asha uses it for n vs n² on 10k rows in a viva.
  • RuleTime Complexity → best / average / worst + extra memory.
  • RememberTime Complexity + a dry-run table (a viva).
  • UseTime Complexity in a viva (n vs n² on 10k rows).
  • TrapTime Complexity — saying ‘fast’ with no Big-O.
  • ExTime Complexity → n vs n² on 10k rows.

Questions

1

What is Time Complexity? Teach it with n vs n² on 10k rows.

2

Name one DSA screen/job that needs Time Complexity.

3

Viva: one wrong answer people give for Time Complexity.

4

Show Time Complexity in a dry-run table terms — three lines max.

Previous← Different Types of Stack OperationsNextArrays are best Data Structure →
P

GoCareerGo

Utilities · Preparation Hub · Resume · CV · Tools — one workspace.

Workspace

DashboardProfilePreparation HubResume builderCV builderCareer planning

PDF Tools

Merge PDFSplit PDFCompress PDFImage to PDFAll toolsJobs

Image & QR

Compress ImageResize ImageQR ScannerQR GeneratorBlogIT interview prep

Company

FAQFeedbackContactPrivacyTermsSitemap

© 2026 GoCareerGo. Keep moving forward.