Skip to content

Instantly share code, notes, and snippets.

@paranoidxc
Created May 22, 2014 08:15
Show Gist options
  • Save paranoidxc/b4961935c96509aac8dc to your computer and use it in GitHub Desktop.
Save paranoidxc/b4961935c96509aac8dc to your computer and use it in GitHub Desktop.
Item max(Item a[], int l, int r)
{
Item u, v; int m = (l+r)/2;
if (l == r) return a[l];
u = max(a, l, m);
v = max(a, m+1, r);
if (u > v) return u; else return v;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment