Bisection, binary search. A search procedure that works in a manner similar to search trees, by repeated halving the
interval of interest in a sorted sequence. The halving is performed by inspecting the middle element and deciding
whether the sought value must lie to the left or right. Running time Q(lg n). A very efficient implementation can be
found in the bisect module. (See Chapter 6.)
Branch and bound. A general algorithmic design approach. Searches a space of solutions in a depth-first or best-
first order by building and evaluating partial solutions. A conservative estimate is kept for the optimal value, while an
optimistic estimate is computed for a partial solution. If the optimistic estimate is worse than the conservative one,
the partial solution is not extended, and the algorithm backtracks. Often used to solve NP-hard problems. (See Listing
11-2 for a branch-and-bound solution to the 0-1 knapsack problem.)
Do'stlaringiz bilan baham: |