Skip to main content
ProductsDesktop toolsTASTECADDrawing reviewTASTEFILESFile managementTASTEFTPFile transferTASTESSHRemote workspaceTASTEZIPCompression and extractionTASTEWINMFile managementDeveloper toolsTASTECODERust integrated development environmentTASTESTUDIOIntegrated development and test environmentTASTEETLData integration (ETL)ServersTASTEREMOTERemote desktop serverTASTEGEOGeospatial serverTASTEMAILMail workspaceInvestingTASTESTOCKStock auto-trading desktop appGet startedDownloadsDocumentationBuyAll products
Marketplace
News
TechNewsToday's dev newsDeveloper docsProgramming languagesRustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDartWeb front-end frameworksNext.jsReactVue.js · NuxtSvelteKitAngularServer frameworksSpring BootDjangoFastAPIASP.NET CoreNestJS · ExpressApp & desktop frameworksTauriFlutterReact NativeElectronAlgorithmsAlgorithm basicsCore algorithmsAdvanced algorithmsPractical algorithms
CommunityProjectsDevelopment logsPromptsAI tool issuesShowcaseCommunity guide
Work with usTech transferWebsite buildDesktop app buildRelease and payment pipelineSales partnerContact
ServicesRemote desktopCustom installer packages
TASTEDEV
Products

Desktop tools

TASTECADComplex drawings, opened with easeTASTEFILESJust the files you need, as fast as possibleTASTEFTPThe tidiest path for your filesTASTESSHA stronger link between you and your serversTASTEZIPPack faster, unpack saferTASTEWINMA keyboard-first file manager with two panes

Developer tools

TASTECODEEdit, build, debug and test Rust apps in one windowTASTESTUDIOFrom editing to remote tests and approved AI fixesTASTEETLMove data while you watch the values

Servers

TASTEREMOTEA remote desktop you run on your own serverTASTEGEORebuilding a GeoServer-compatible geospatial server in RustTASTEMAILTake back control of your email

Investing

TASTESTOCKStock auto-trading that follows the rules you set: when, and what

Get started

DownloadsLatest builds of every productDocsHow to use each productBuySubscriptions and perpetual licencesAll productsEvery product at a glance
All products
MarketplaceNews
Tech

News

Today's dev newsOfficial announcements on languages, frameworks, GitHub and AIDeveloper docsGuides to languages, frameworks and algorithms

Programming languages

RustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDart

Frameworks

Web front-end frameworksNext.jsReactVue.js · NuxtSvelteKitAngular
Server frameworksSpring BootDjangoFastAPIASP.NET CoreNestJS · Express
App & desktop frameworksTauriFlutterReact NativeElectron

Algorithms

Algorithm basicsComplexity analysis · Sorting · Searching · Basic data structures · Trees and heapsCore algorithmsGraph traversal · Shortest paths & minimum spanning trees · Dynamic programming · Greedy algorithms · Divide and conquer · BacktrackingAdvanced algorithmsString algorithms · Math and number theory · Bit manipulation · Segment trees · Union-findPractical algorithmsCoding interview strategy · LRU cache · Rate limiting · Consistent hashing
All development docs
Community
ProjectsDiscover builders and their workDevelopment logsDecisions and lessons learnedPromptsReusable instructionsAI tool issuesProblems and workarounds for Claude, Codex, GeminiShowcaseFinished resultsCommunity guideHow we build in the open
Work with us
Tech transferNative apps in Rust and eguiWebsite build10 languages, accounts, docs and downloadsDesktop app buildRust and egui, no WebViewRelease and payment pipelineSigning, MSI, deb, rpm, AppImage, hashesSales partnerRecommend us and earn 30%ContactBuilds, partnerships and investment
Services
Remote desktopReach your computer from a browserCustom installer packagesOnly the features you need, settings preloaded
Buy
EN
한국어EnglishDeutschEspañolFrançaisItalianoPortuguês (Brasil)日本語简体中文繁體中文
Log in
Log in
TASTEDEV

From small tools to better development.

support@tastedev.netSupport TASTEDEV
ProductsProduct lineupBuyDocsDownloadsMarketplaceSupport
CommunityProjectsDevelopment logsPromptsAI tool issuesShowcase
PoliciesAbout usPrivacy policyTerms of serviceSubscription termsRefund policyCommunity guidelines
AccountLog inSign up
Visitors
Today
Yesterday
Total views
Company
GXSOFT
Representative
CHOI YOUNG GU
Business registration number
853-44-00368
Address
9F V24, 351 Gyeongin-ro, Michuhol-gu, Incheon, Republic of Korea
Phone
+82-10-4404-1523
Email
whitecalvin@tastedev.net
Privacy officer
CHOI YOUNG GU

© 2026 TASTEDEVProduct information is based on verified development sources.Released · improving

Developer docs
Searching
SearchingReference implementationStep-by-step guideOfficial docs and resourcesDiscussionsComments

Other algorithms

Algorithm basics4
Complexity analysisSortingBasic data structuresTrees and heaps
Core algorithms6
Graph traversalShortest paths & minimum spanning treesDynamic programmingGreedy algorithmsDivide and conquerBacktracking
Advanced algorithms5
String algorithmsMath and number theoryBit manipulationSegment treesUnion-find
Practical algorithms4
Coding interview strategyLRU cacheRate limitingConsistent hashing

Algorithm

Searching

Searching finds a value or position in data: linear search, binary search, lower_bound and upper_bound, binary search on the answer, and hash lookups.

Start the guideDiscussions

Searching is the task of finding a value, or the position where some condition first holds, inside a collection of data. Linear search checks elements one by one and works on any data, while binary search halves a sorted range at every step and needs only about 20 comparisons for a million elements. For exact-match lookups, a hash table answers in constant time on average.

Searching matters because almost every program looks things up: database indexes, autocomplete, log analysis and routing tables all rely on it. Binary search also goes beyond arrays. Whenever a yes/no condition flips only once over a range, you can binary search the answer itself, which turns many optimization problems in coding interviews into short, reliable code.

Start by writing linear search and a closed-interval binary search yourself, then practice the half-open lower_bound and upper_bound forms until the boundary handling feels natural. Trace small arrays by hand, test your code against Python's bisect module with random inputs, and finally work through optimization problems that call for binary search on the answer and ternary search.

On this page

  1. Highlights
  2. Where it is used
  3. Reference implementation
  4. Step-by-step guide
  5. Official docs and resources
  6. Discussions
  7. Comments

Highlights

Linear search

Compares elements one by one in O(n) time. It needs no sorting and is often the fastest option for small collections.

Binary search

Halves a sorted range at every step and finds values in O(log n) time. An iterative version uses only O(1) extra memory.

lower_bound and upper_bound

Return the first position whose value is at least, or strictly greater than, the target. Their difference counts duplicates, and Python's bisect module provides both.

Binary search on the answer

Parametric search turns 'what is the smallest feasible value?' into a yes/no test and binary searches the range of possible answers.

Where it is used

  • Database indexes and range queries
  • Finding regressions with git bisect
  • Looking up values by time in sorted logs and time series
  • Optimization problems in coding interviews

Reference implementation

lower_bound in Python

lower_bound returns the first index whose value is at least x, working on the half-open range [lo, hi). When the middle value is smaller than x it discards the left half; otherwise it discards the right half. contains uses that index to test membership, and the last line confirms the result matches bisect.bisect_left from the standard library.

searching.py

from bisect import bisect_left


def lower_bound(a, x):
    """Return the first index i with a[i] >= x (len(a) if there is none)."""
    lo, hi = 0, len(a)
    while lo < hi:
        mid = (lo + hi) // 2
        if a[mid] < x:
            lo = mid + 1
        else:
            hi = mid
    return lo


def contains(a, x):
    i = lower_bound(a, x)
    return i < len(a) and a[i] == x


if __name__ == "__main__":
    data = [2, 5, 8, 12, 16, 23, 38, 56, 72, 91]
    print(lower_bound(data, 23), contains(data, 23))   # 5 True
    print(lower_bound(data, 24), contains(data, 24))   # 6 False
    print(lower_bound(data, 24) == bisect_left(data, 24))   # True
python searching.py

Step-by-step guide

Six chapters that take you from installation to the core ideas of Searching.

  1. Searching Concepts
  2. How It Works
  3. Implementation
  4. Complexity
  5. Practice Problems
  6. Searching in the Real World

Official docs and resources

  • Officialbisect — Array bisection algorithm
  • Officialgit-bisect Documentation
  • LearnBinary search (cp-algorithms)
  • LearnTernary search (cp-algorithms)
  • LearnBinary search (Khan Academy)
  • ReferenceBinary search (Wikipedia)
  • ReferenceLinear search (Wikipedia)
  • Referencestd::lower_bound (cppreference)

Discussions

Start a discussion

Ask questions, share experience and trade opinions about Searching.

No discussions yet. Start the first one.

0 comments

Top commentsNewest first

Sign in · Sign in to leave a comment.