Hello,
I am implementing a solution where I look at the current time and loop through a series of appointments to see if any of the appointments occur during this minute. My current solution is not working well as it is inefficient and I'm having trouble finding a way to do a more efficient search.
I am currently looping through the Occurrences collection of the recurrence rule for every appointment in my list (can be hundreds or thousands). The only limiting factor that makes my algorithm slightly efficient is that I end the loop through the occurrences once the current occurrence time is in the future (or past the current minute).
Question:
I'd like to do a binary search through the occurrences collection. This would require that I know the # of occurrences in the appointment so I can look at the midway point to determine if it is in the future or past.
ex)
intPosition = Floor(Appointment.Occurrences.Count / 2);
if((DateTime)Appointment.Occurrences[intPosition] > dateCurrent) --> Continue with Binary search...
The only issue is that there does not seem to be any information available to me about the Occurrences collection.
Question
Is there any way to do what I mentioned above? Is there a better way to approach this given my scenario of having a list of appointments and needing to see if the current time is the time for any of the appointments?
Thanks in advance,
Ryan
I am implementing a solution where I look at the current time and loop through a series of appointments to see if any of the appointments occur during this minute. My current solution is not working well as it is inefficient and I'm having trouble finding a way to do a more efficient search.
I am currently looping through the Occurrences collection of the recurrence rule for every appointment in my list (can be hundreds or thousands). The only limiting factor that makes my algorithm slightly efficient is that I end the loop through the occurrences once the current occurrence time is in the future (or past the current minute).
Question:
I'd like to do a binary search through the occurrences collection. This would require that I know the # of occurrences in the appointment so I can look at the midway point to determine if it is in the future or past.
ex)
intPosition = Floor(Appointment.Occurrences.Count / 2);
if((DateTime)Appointment.Occurrences[intPosition] > dateCurrent) --> Continue with Binary search...
The only issue is that there does not seem to be any information available to me about the Occurrences collection.
Question
Is there any way to do what I mentioned above? Is there a better way to approach this given my scenario of having a list of appointments and needing to see if the current time is the time for any of the appointments?
Thanks in advance,
Ryan