Skip to content

Instantly share code, notes, and snippets.

View simonjohn027's full-sized avatar

Simon John simonjohn027

  • Home
  • Dar es Salaam Tanzania
View GitHub Profile
Implementation of Bag ADT
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();
@simonjohn027
simonjohn027 / LinkedList
Last active January 28, 2019 07:29
First Few Methods for adding and removing elements in the List
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){
@simonjohn027
simonjohn027 / gist:0de7778b47b2652fef8688d0ae037e89
Created January 31, 2019 03:35
String Stack Implemetion using Normal Arrays
//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
*
@simonjohn027
simonjohn027 / GenStack.java
Created February 2, 2019 05:55
Generic Stack Implementation using arrays
//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
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();