java data structure

profiletom229

Problem 1: Implement QueueADT using 2 stacks as instance variables, suchthat all queue operations execute in O(1) time.

Problem 2: Design an ADT for a two-color, double-stack ADT that consists of 2stacks — one “red” and one “blue” — and has its operations color-codedversions of the regular stack ADT operations. For example, this ADT shouldsupport both a redPush operation and a bluePush operation. Give an efficientimplementation of this ADT using a single array whose capacity is set at somevalue N that is assumed to always be larger than the sizes of the red and bluestacks combined.

    • 10 years ago
    • 10
    Answer(1)

    Purchase the answer to view it

    blurred-text
    NOT RATED
    • attachment
      queue.zip
    Bids(1)