Hello, maybe im wrong, (im new to rust) but seeing the queue code, the dequeue operation
is taking O(n) time, and its suposed to take O(1) time.
I assume that the vector is implemented like in other languages (e.g c++) and a vector is really a dynamic array, and remove the first take O(n) because you need to swap all the elements one position to the left.
If this assumption is false, then ignore this comment.
Yes, it's O(n). Because it's implment with Vec, remove the first elem then all the elements remained one position to the left. If expect O(1), use LinkList to impl.
Queue is not correctly implemented #266
Hello, maybe im wrong, (im new to rust) but seeing the queue code, the dequeue operation is taking O(n) time, and its suposed to take O(1) time.
I assume that the vector is implemented like in other languages (e.g c++) and a vector is really a dynamic array, and remove the first take O(n) because you need to swap all the elements one position to the left.
If this assumption is false, then ignore this comment.