Data structures and algorithms

1.Implement two stacks in one array A[1..n], such that neither stack overflows unless the total number of elements in both stacks together is n. The PUSH and POP operations should run in O(1) time.

2.Implement a θ(n) time non-recursive program that reverses a singly linked list L of n elements. The program gets the head of the list (L.head) as input and cannot use any storage other than the given list.