Use scala.collection.immutable.Queue for FIFOQueue instead of List#3
Conversation
|
This FIFOQueue requires O(n) time for |
|
Thank you for your contribution!!!! |
|
Thanks to your response. |
|
Now, there is the constraint on any CustomQueue. But I am considering that the constraint should be depends on applications. So I am going to add CustomQueue trait And I think |
|
I forgot to say.. It is a good question!! |
188c985 to
3748579
Compare
scala.collection.immutable.List is a singly linked list, so it is not efficient(O(n)) to append elements. Using scala.collection.immutable.Queue, enqueue will be faster.
3748579 to
7d7eab3
Compare
|
Updated branch.
I agree this point, so I didn't change any interfaces and improve perfomance only. |
Use scala.collection.immutable.Queue for FIFOQueue instead of List
|
Thanks!! |
scala.collection.immutable.List is a singly linked list, so it is not efficient(O(n)) to append elements.
Using scala.collection.immutable.Queue, enqueue will be faster.