Computer engineering · also Perception and intelligenceLevel 4 · Systems Engineer
Algorithms, searching and complexity
An algorithm is a precise, finite recipe for solving a problem, and one problem often has algorithms with very different costs. Engineers estimate cost by counting steps as the input size n grows, written in big-O notation, which keeps only the fastest-growing term. One pass through the data is O(n); comparing every item with every other is O(n²), so ten times more data means about a hundred times more work. Binary search finds an item in a sorted list of a million entries in about twenty comparisons, O(log n), against up to a million for checking each in turn. Good sorting costs O(n log n), so sorting once pays off when searching many times. Big-O ignores constant factors and memory, so small cases still need measuring.
Why it mattersMatching each camera frame to the nearest force reading in a long robot log takes seconds with sorted data and binary search, but hours if every pair is compared.