Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: e9dceb14be
Fetching contributors…

Cannot retrieve contributors at this time

39 lines (32 sloc) 0.601 kb
namespace AlgoGeo {
class Stack<G> : Object {
private G [] _data = {};
private int _size = 0;
public void push(G o){
_data += o;
++_size;
}
public G pop(){
G d = this.top();
if(_size -1 >= 1){
_data = _data[0:--_size];
}else{
_size = 0;
_data = {};
}
return d;
}
public G top(){
return _size > 0 ? _data[_size-1] : null;
}
public bool empty(){
return _size == 0;
}
public int size(){
return _size;
}
public G [] to_array(){
return _data;
}
}
}
Jump to Line
Something went wrong with that request. Please try again.