-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMPROVEMENT] Double linked list used to improve performance of deque…
…ue and remove operations in OperationQueue (#1899) * [IMPROVEMENT] Double linked list used to improve performance of dequeue and remove operations in OperationQueue - remove() and dequeue() methods time complexity reduces to O(1) from O(n). - All arrays, veryHigh, high, normal, low, veryLow, all, converted to DoubleLinkedList. - New internal class _IndexedOperationLinkedList introduced specifically to work with Operation. - HashMap used to index, node by it's operation, in the linked list, in order to avoid traversing the list to find a node, which in return reduces the time complexity to O(1). - Unit Test added to test cancel one operation and cancel operations of a specific queue priority * Fixed an issue that was failing OperationQueue's unit tests to fail - In _IndexedOperationLinkedList internal class, when removing an node from Double linked list, the bug was setting the root not the linked list to nil. * In Operation, private properties, next and previous, introduced to use the operation instance as node in double linked list
- Loading branch information
1 parent
5f48836
commit aa34ba0
Showing
2 changed files
with
223 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters