Storing more than two stacks in a single one-dimensional


Storing more than two stacks in a single one-dimensional array in such a way that no stack-full condition occurs for any of the stacks until all the array elements have been used cannot be done as efficiently as in Exercise 12, because some of the array elements will have to be shifted. Nevertheless, design a dynamic-array-based class for an n-stack data type using this implementation, n > 2. In the functions for the basic stack operations, the stack number being operated upon, 1,2, ..., n, should be passed as a parameter. (Hint: You might partition the storage array into n equal sub arrays, one for each stack, and use two arrays of "pointers," my Bottom and my Top, to keep track of where the bottoms and the tops of the stacks are located in the storage array. When one of these stacks becomes full, search to find the nearest empty location(s) in the array, and then move stacks as necessary to enlarge the storage space for this stack.)

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: Storing more than two stacks in a single one-dimensional
Reference No:- TGS02584550

Expected delivery within 24 Hours