2 questions of 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.

Code need in Java

Need your ASSIGNMENT done? Use our paper writing service to score good grades and meet your deadlines.

Order a Similar Paper Order a Different Paper