Skip to content
This repository was archived by the owner on Dec 12, 2023. It is now read-only.

Commit 799a8a2

Browse files
committed
Rename stack and queue methods.
1 parent 6dac95c commit 799a8a2

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

queue/Readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Basic Queue
22

3-
Implement a basic queue function with the ability to `add` and `remove` values.
3+
Implement a basic queue function with the ability to `enqueue` and `dequeue` values. This is a basic first-in first-out data structure.

queue/queue.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var Queue = module.exports = function () {
44
this.length = 0;
55
};
66

7-
Queue.prototype.add = function (value) {
7+
Queue.prototype.enqueue = function (value) {
88
var node = {
99
value: value,
1010
next: null
@@ -26,7 +26,7 @@ Queue.prototype.add = function (value) {
2626
return this.length += 1;
2727
};
2828

29-
Queue.prototype.remove = function () {
29+
Queue.prototype.dequeue = function () {
3030
if (!this.head) { return; }
3131

3232
var node = this.head;

stack/Readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Basic Stack
22

3-
Implement a basic stack function with the ability to `add` and `remove` values.
3+
Implement a basic stack function with the ability to `push` and `pop` values. This is a basic first-in last-out data structure.

stack/stack.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ var Stack = module.exports = function () {
33
this.length = 0;
44
};
55

6-
Stack.prototype.add = function (value) {
6+
Stack.prototype.push = function (value) {
77
var node = {
88
value: value,
99
next: null
@@ -19,7 +19,7 @@ Stack.prototype.add = function (value) {
1919
return this.length += 1;
2020
};
2121

22-
Stack.prototype.remove = function () {
22+
Stack.prototype.pop = function () {
2323
// If there is no head node, return `undefined`
2424
if (!this.head) { return; }
2525

0 commit comments

Comments
 (0)