Results 1 to 2 of 2

Thread: Stacks

  1. #1
    Malv is offline Member
    Join Date
    Jun 2013
    Rep Power

    Default Stacks

    Given the following interface for Stack objects:
    Java Code:
    public interface Stack<AnyType>{
    public boolean empty(); // true if stack empty
    public AnyType top(); // returns top element
    public AnyType pop(); // returns and removes top
    public void push(AnyType val); //adds to top
    and the following interface for Simple array objects:
    Java Code:
    public interface SimpArray<AnyType>{
    public AnyType get(int i); // returns the value at
    // index i
    Answer the following questions:
    i. Precisely describe how two stacks can be be used to implement
    the get() operation of SimpArray. Note, your implementation
    does not have to be efficient.

    How do I describe this question?

    ii. Can a single stack be used to implement a SimpArray datatype?
    Briefly justify your answer.

    What does this question means?

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Voorschoten, the Netherlands
    Blog Entries
    Rep Power

    Default Re: Stacks

    Quote Originally Posted by Malv View Post
    How do I describe this question?
    I'd say: the question is well formulated; the note is a real spoiler.

    The only person who got everything done by Friday was Robinson Crusoe.

Similar Threads

  1. Can somebody help me with stacks?
    By sim18 in forum New To Java
    Replies: 3
    Last Post: 10-08-2012, 07:06 PM
  2. stacks
    By nevets93 in forum New To Java
    Replies: 6
    Last Post: 02-25-2011, 04:32 AM
  3. Help with stacks
    By kMel90 in forum New To Java
    Replies: 3
    Last Post: 12-05-2010, 02:02 AM
  4. Stacks
    By Zosden in forum Advanced Java
    Replies: 15
    Last Post: 05-05-2008, 08:16 AM
  5. Using Stacks
    By ravian in forum New To Java
    Replies: 7
    Last Post: 11-28-2007, 10:53 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts