This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Implementation of Bag ADT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public interface Bag { | |
| //public static final String material = "Cotton"; | |
| public abstract void add( String itemName, double itemSize, double itemWeight ); | |
| public abstract void remove(T t); | |
| public abstract int size(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class LinkNode<E>{ | |
| private E element; | |
| private LinkNode<E> next; | |
| public LinkNode(){ | |
| this.element = null; | |
| this.next = null; | |
| } | |
| public LinkNode(E elem, LinkNode<E> next){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //This is the data Structure that follows the LIFO | |
| // Stack is the linear Data structure in which add and remove operation | |
| //can only be done on one end following LIFO principle. | |
| //Can be implemented using Arrays or LinkedList | |
| /*This data Structure(Stack) extends the Vector Class which implemented * | |
| *the following interfaces: | |
| * 1. List which extends 2. Collection which extends Iterators | |
| * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //This is the data Structure that follows the LIFO | |
| // Stack is the linear Data structure in which add and remove operation | |
| //can only be done on one end following LIFO principle. | |
| //Can be implemented using Arrays or LinkedList | |
| /*This data Structure(Stack) extends the Vector Class which implemented * | |
| *the following interfaces: | |
| * 1. List which extends 2. Collection which extends Iterators |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.omg.CORBA.Object; | |
| interface QueueADT <T> { | |
| public void enqueue(T t); | |
| public <T> T dequeue (); | |
| public <T> T peek(); | |
| public boolean isFull(); | |
| public boolean isEmpty(); | |
| public void clear(); |