SEQUENTIAL_SEARCH2(A,k)
- A[n] ← k
- i ← 0
- while A[i] ≠ k do
- i ← i + 1
- if i < n
- return i
- else
- return -1
BRUTE_FORCE_STRING_MATCH(T[0..n-1],P[0..m-1])
- for i ← 0 to n-m do
- j ← 0
- while j < m and P[j] = T[i+j] do
- j ← j + 1
- if j = m
- return i
- return -1
BRUTE_FORCE_CLOSEST_PAIR(P)
- d ← ∞
- for i ← 1 to n-1 do
- for j ← i+1 to n do
- d ← min(d, sqrt((xi-xj)2 + (yi-yj)2)
- return d
BRUTE_FORCE_CONVEX_HULL(P)
- C ← {}
- for i ← 1 to n -1 do
- for j ← i+1 to n do
- state ← unknown;
- for k ← 0 to n do
- if i ≠ k and j ≠ k then
- Θ = mag(<Pi,Pj> × <Pi,Pk>)/ (mag(<Pi,Pj>)mag(<Pi,Pk>))
- if PiPjPk are colinear (Θ= 0)
- if Pk is between Pi and Pj
- continue
- else
- state ← NOT_IN
- elseif Θ < 0
- if state = unknown
- state ← left
- elseif state = right
- state ← NOT_IN
- else
- if state = unknown
- state ← right
- elseif state = left
- state ← NOT_IN
- if state ≠ NOT_IN
- C ← C ∪ <Pi,Pj>