Created
November 7, 2014 08:13
-
-
Save LittleHelicase/b9cfb22fb399fc32fc32 to your computer and use it in GitHub Desktop.
// source http://jsbin.com/zucuze
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>DuA Stack Implementierung</title> | |
<!-- der Stack wird über die ArrayList implementiert --> | |
<script src="http://jsbin.com/cuqure.js"></script> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
function ArrayStack(){ | |
this.arrayList = null; | |
this.create = function(){ | |
this.arrayList = new ArrayList(); | |
this.arrayList.create(); | |
}; | |
this.empty = function(){ | |
return (this.arrayList.length() === 0); | |
}; | |
this.pop = function(){ | |
var val = this.top(); | |
this.arrayList.deletePos(this.arrayList.last()); | |
return val; | |
}; | |
this.top = function(){ | |
return this.arrayList.retrieve(this.arrayList.last()); | |
} | |
this.push = function(x){ | |
this.arrayList.insert(this.arrayList.last(),x); | |
} | |
} | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">function ArrayStack(){ | |
this.arrayList = null; | |
this.create = function(){ | |
this.arrayList = new ArrayList(); | |
this.arrayList.create(); | |
}; | |
this.empty = function(){ | |
return (this.arrayList.length() === 0); | |
}; | |
this.pop = function(){ | |
var val = this.top(); | |
this.arrayList.deletePos(this.arrayList.last()); | |
return val; | |
}; | |
this.top = function(){ | |
return this.arrayList.retrieve(this.arrayList.last()); | |
} | |
this.push = function(x){ | |
this.arrayList.insert(this.arrayList.last(),x); | |
} | |
}</script></body> | |
</html> |
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
function ArrayStack(){ | |
this.arrayList = null; | |
this.create = function(){ | |
this.arrayList = new ArrayList(); | |
this.arrayList.create(); | |
}; | |
this.empty = function(){ | |
return (this.arrayList.length() === 0); | |
}; | |
this.pop = function(){ | |
var val = this.top(); | |
this.arrayList.deletePos(this.arrayList.last()); | |
return val; | |
}; | |
this.top = function(){ | |
return this.arrayList.retrieve(this.arrayList.last()); | |
} | |
this.push = function(x){ | |
this.arrayList.insert(this.arrayList.last(),x); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment