0

I am wondering if using Deque data structure implemented by ArrayDeque could offer better performance in terms of time complexity compared to the queue implemented by an array or a linked list?

As far as I have understood, both implementations could be O(n) in the worst_case.

  • Does this answer your question? [Why is ArrayDeque better than LinkedList](https://stackoverflow.com/questions/6163166/why-is-arraydeque-better-than-linkedlist) – lkatiforis Dec 05 '21 at 07:30
  • `LinkedList` is never the answer to “fastest” anything. It has poor memory performance characteristics, hampering whatever theoretical benefit it might have. Moreover the fastest way to check for a palindrome is to loop over the `String` directly. – Boris the Spider Dec 05 '21 at 07:42

0 Answers0