What is the complexity of upper_bound and lower_bound functions?

On Sun, Jun 19, 2011 at 1:10 PM, saurabh singh <[email protected]> wrote:

>
>
> #include<iostream>
> #include<algorithm>
> using namespace std;
> int main()
> {
> int a[]={1,2,2,3,4,4,5};
> int key=2;
> int *p,*q;
> p=upper_bound(a,a+(sizeof(a)/sizeof(int)),key);
> q=lower_bound(a,a+(sizeof(a)/sizeof(int)),key);
> cout<<p-q;
> }
>
> This is it.Is that too complex?
>
>
>
>>
>
>
>
> --
> Saurabh Singh
> B.Tech (Computer Science)
> MNNIT ALLAHABAD
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to