Binäre Suche (EN)

Term

Efficient search method for sorted data with logarithmic complexity

Binäre Suche

Binary search is an efficient search procedure that only works on sorted data and has a logarithmic time complexity of O(log n). The algorithm compares the element being searched with the middle element of the sorted sequence and reduces the search space by half each time, depending on the comparison result. Unlike linear search, which must check all elements in the worst case, binary search is significantly faster for large datasets. Binary search is a fundamental concept in computer science and is implemented in many data structures such as binary search trees.

Suchprozess

flowchart TD   A[Start] --> B{Suchraum nicht leer?}   B -- Ja --> C[Mitte berechnen]   C --> D{Element gefunden?}   D -- Ja --> E[Position zurückgeben]   D -- Nein --> F{Element kleiner?}   F -- Ja --> G[Suchraum auf linke Hälfte beschränken]   F -- Nein --> H[Suchraum auf rechte Hälfte beschränken]   G --> B   H --> B   B -- Nein --> I[Element nicht gefunden] 
Quelle: AI Generated