function Vector() {

  this.obj = new Array(),

  this.addElement = function(element) {
    var i = this.obj.length;
    this.obj[i] = element;
  };

  this.add = function(element) {
    this.addElement(element);
  }
  
  this.removeElement = function(element) {
    for(var i=0;i<this.obj.length;i++) {
      if(this.obj[i]==element) {
        this.obj[i] = null;
      }
    }
    this.compact();
  }

  this.remove = function(element) {
    this.removeElement(element);
  }

  this.removeElementAt = function(index) {
    if(this.obj[index]==element) {
      this.obj[index] = null;
    }
    this.compact();
  }

  this.elementAt = function(index) {
    if(this.obj[index]!=null) {
      return this.obj[index];
    }
  };

  this.get = function(index) {
    return this.elementAt(index);
  }
  
  this.clear = function() {
  	this.obj = new Array();
  };
  
  this.size = function() {
	return this.obj.length;    
  };

  this.contains = function(element) {
    for(var i=0;i<this.obj.length;i++) {
      if(this.obj[i]!=null) {
        if(this.obj[i]==element) return true;
      }
    }
    return false;
  }

  this.compact = function() {
      var s = 0;
      for(var i=0;i<this.obj.length;i++) {
        if(this.obj[i]!=null) s++;
      }
      if(this.obj.length>s) {
      	var tmp = new Array();
      	for(var j=0;j<this.obj.length;j++) {
      	  if(this.obj[j]!=null) {
      	    tmp[tmp.length] = this.obj[j];
      	  }
      	}
      	this.obj = tmp;
      }
  };
}

function HashMap() {

  this.obj = new Array(),

  this.put = function(key, value) {
    var i = this.obj.length;
    if(this.containsKey(key)) {
      this.remove(key);
    }
    this.obj[i] = new Array(key, value);
  };

  this.get = function(key) {
    for(var i=0;i<this.obj.length;i++) {
      if(this.obj[i]!=null) {
        if(this.obj[i][0]==key) return this.obj[i][1];
      }
    }
  };

  this.getKeyByIndex = function(index) {
    if(this.obj[index]!=null) {
	return this.obj[index][0];
    }
  };

  this.getValueByIndex = function(index) {
    if(this.obj[index]!=null) {
	return this.obj[index][1];
    }
  };

  this.remove = function(key) {
    for(var i=0;i<this.obj.length;i++) {
      if(this.obj[i]!=null) {
        if(this.obj[i][0]==key) {
        	this.obj[i]=null;
	    }
      }
    }
    this.compact();
  };
  
  this.clear = function() {
  	this.obj = new Array();
  };
  
  this.size = function() {
	return this.obj.length;    
  };

  this.containsKey = function(key) {
    for(var i=0;i<this.obj.length;i++) {
      if(this.obj[i]!=null) {
        if(this.obj[i][0]==key) return true;
      }
    }
    return false;
  }

  this.containsValue = function(value) {
    for(var i=0;i<this.obj.length;i++) {
      if(this.obj[i]!=null) {
        if(this.obj[i][1]==value) return true;
      }
    }
    return false;
  }
  
  this.contains = function(value) {
  	return this.containsValue(value);
  };

  this.compact = function() {
      var s = 0;
      for(var i=0;i<this.obj.length;i++) {
        if(this.obj[i]!=null) s++;
      }
      if(this.obj.length>s) {
      	var tmp = new Array();
      	for(var j=0;j<this.obj.length;j++) {
      	  if(this.obj[j]!=null) {
      	    tmp[tmp.length] = this.obj[j];
      	  }
      	}
      	this.obj = tmp;
      }
  };
}