Comparing Complexities of Two ArrayDeques and a Single TreeMap (Java)

Revision en1, by dualthread, 2023-02-13 06:24:23

Which of the following offers better overall complexity in terms of both time and space (Java)

a). 2 ArrayDeque structures

or

b). a Single TreeMap ?

Can you provide some guidance on this?

I was trying to solve 1793C - Dora and Search in the Codeforces Round 852 (Div. 2) with both options, I passed all the test cases using a TreeMap, but it seems to have memory size of 15100 KB. Can you guys help in evaluating complexities and suggesting which of them is better?

Tags complexity, treemap, deque

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English dualthread 2023-02-13 06:24:23 535 Initial revision (published)