LinkedStack data structure and Dynamic Connectivity problem