by hqm42 · 13y ago · 0 comments
LinkedList.prototype.reverse = function () {
var rev = function(e,tail) {
if (!e) {
return tail;
} else {
var next = e.next;
e.next = tail;
return rev(next, e);
}
};
this.head = rev(this.head, null);
};No comments yet.