A datastructure for Robotic Sort

Posted by amit.codename13 on Stack Overflow See other posts from Stack Overflow or by amit.codename13
Published on 2010-04-17T08:19:53Z Indexed on 2010/04/17 8:23 UTC
Read the original article Hit count: 253

Filed under:
|

I am trying to solve this problem :

https://www.spoj.pl/problems/CERC07S/

I have identified that i need a datastructure in which reversing operations have lesser time complexity. I tried to create one using a doubly linked list, in which (i thought) reversing can be done in O(1) by just changing a value associated with the starting and ending node which indicates the direction of traversing the list. I tried to implement it but got stuck. Maybe the approach is wrong!

Are trees applicable here? If yes, how? Any ideas or links are appreciated?

Thanks in advance.

© Stack Overflow or respective owner

Related posts about datastructure

Related posts about spoj