This is good.  Another way is to build an interval tree and then query
it for every appointment's start time.

On Dec 4, 2:56 pm, Dave <[email protected]> wrote:
> If you expect a lot of conflicting appointments:
>
> Sort the appointments into ascending order by starttime.
> Establish an empty min heap of {starttime,endtime} ordered by endtime.
> Process the given appointments one by one:
>     While the heap is not empty and the endtime of the root does not
> exceed the the starttime of the appointment
>         Delete the root of the heap.
>     If the heap is not empty, then
>         The given appointment conflicts with every appointment in the
> heap.
>     Insert the given appointment into the heap.
>
> Dave
>
> On Dec 3, 10:43 pm, Prims <[email protected]> wrote:
>
>
>
> > You are given 'n' appointments. Each appointment contains startime and
> > endtime. You have to retun all conflicting appointments efficiently
>
> > starttime and endtime can range from a few min to few years.- Hide quoted 
> > text -
>
> - Show quoted text -

-- 
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