Skip to content

Instantly share code, notes, and snippets.

@cammckinnon
Last active December 14, 2015 02:49
Show Gist options
  • Save cammckinnon/5016147 to your computer and use it in GitHub Desktop.
Save cammckinnon/5016147 to your computer and use it in GitHub Desktop.
Maxima(P1...Pn)
if n=1: return <p1>
A = {a1...aj} = Maxima(p1...pn/2)
S = {s1...sk} = Maxima(pn/2...pn)
i = 1
while ai > s1.y and i < j, do: i += 1
return {a1...a(i-1)} + {s1...sk}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment