-
Thayumanavar S authored
Scheduling of the events based on timeline is not honored when some event is removed. This is because when we remove an event from any position in the priority queue, we need to adjust heap both upward and downward depending on new value at the deleted node and the value of the parent node. If value of parent node is less than the current value of deleted node, the heap needs to be adjusted upwards (until heap property is satisfied) else downwards (in comparison with it's children and exchanging if heap property is violated). In the current code, heapify() adjusts the heap downwards only. The update() function adjusts the heap downward as well as upward (based on comparison of the replaced (deleted) node and the parent node). Thus the patch fixes the issue by calling update() method after element is removed, which ensures the heap property. Change-Id: Id449f0de4c59c8f6994bcd21708d4c8038d154e4
Thayumanavar S authoredScheduling of the events based on timeline is not honored when some event is removed. This is because when we remove an event from any position in the priority queue, we need to adjust heap both upward and downward depending on new value at the deleted node and the value of the parent node. If value of parent node is less than the current value of deleted node, the heap needs to be adjusted upwards (until heap property is satisfied) else downwards (in comparison with it's children and exchanging if heap property is violated). In the current code, heapify() adjusts the heap downwards only. The update() function adjusts the heap downward as well as upward (based on comparison of the replaced (deleted) node and the parent node). Thus the patch fixes the issue by calling update() method after element is removed, which ensures the heap property. Change-Id: Id449f0de4c59c8f6994bcd21708d4c8038d154e4
Loading