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

DSA · Theory

Linear Search

← All stacks

Theory

45/810

Linear Search

Linear Search is a DSA topic. In plain words you use it for find roll 12 in a sorted list. Don’t start with a slogan — start with that picture.

Smallest example: linear vs binary. Type it, run it, and say what you see. If you can do that from memory, you know Linear Search.

From the example next to this theory — Linear search checks items one by one — O(n).

Trap — binary search on unsorted data. Fix that before you talk about advanced DSA.

Viva — what is Linear Search? Then show linear vs binary. Then name the trap.

Exam tip

What is Linear Search? Show this: linear vs binary. Trap: binary search on unsorted data.

Example

def linear_search(arr, target):
    for i, x in enumerate(arr):
        if x == target:
            return i
    return -1

print(linear_search([4, 2, 9, 1], 9))

Linear search checks items one by one — O(n).

Short notes

  • DefLinear Search — find roll 12 in a sorted list.
  • Rulelinear vs binary
  • Trapbinary search on unsorted data
  • Usea sorted list

Questions

1

What is Linear Search?

2

Give one small example of Linear Search.

3

What mistake do beginners make with Linear Search?

4

Where do you use Linear Search?

45 / 810

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.