比较堆栈和队列数据结构

时间:2014-08-08 23:31:58

标签: data-structures stack queue

来自http://www.brpreiss.com/books/opus5/

的设计模式

enter image description here

public interface Comparable {
    boolean isLT (Comparable object);
    boolean isLE (Comparable object);
    boolean isGT (Comparable object);
    boolean isGE (Comparable object);
    boolean isEQ (Comparable object);
    boolean isNE (Comparable object);
    int compare (Comparable object);
}


public interface Container extends Comparable{
    int getCount();
    boolean isEmpty();
    boolean isFull();
    void purge();
    Enumeration getEnumeration();
}


public interface Queue extends Container { 
    Object getHead() throws ContainerEmptyException;
    void enqueue (Object object) throws ContainerFullException;
    Object dequeue() throws ContainerEmptyException;
}

除了number of elements之外,我们可以用什么其他合理的标准来比较堆栈和队列。

0 个答案:

没有答案