Home/Blog/Exams & Theory

Binary Search in Structograms: Divide-and-Conquer Step by Step

2026-11-227 min read

1. Sorted Array Requirement

Binary search halves the remaining search space on every step by comparing the target with the middle element, achieving O(log n) runtime.

Live Example (DIN 66261)

Rendered directly in DIN 66261 — click to open and edit in the workspace.

binaereSuche(arr, ziel)links = 0; rechts = laenge(arr) - 1; pos = -1mitte = (links + rechts) DIV 2pos = mittelinks = mitte+ 1rechts =mitte - 1arr[mitte] < zielwahrfalscharr[mitte] == zielwahrfalschlinks <= rechts UND pos == -1Rückgabe: pos

More Articles