This repository was archived by the owner on Dec 12, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +6
-6
lines changed Expand file tree Collapse file tree 4 files changed +6
-6
lines changed Original file line number Diff line number Diff line change 1
1
# Basic Queue
2
2
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 .
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ var Queue = module.exports = function () {
4
4
this . length = 0 ;
5
5
} ;
6
6
7
- Queue . prototype . add = function ( value ) {
7
+ Queue . prototype . enqueue = function ( value ) {
8
8
var node = {
9
9
value : value ,
10
10
next : null
@@ -26,7 +26,7 @@ Queue.prototype.add = function (value) {
26
26
return this . length += 1 ;
27
27
} ;
28
28
29
- Queue . prototype . remove = function ( ) {
29
+ Queue . prototype . dequeue = function ( ) {
30
30
if ( ! this . head ) { return ; }
31
31
32
32
var node = this . head ;
Original file line number Diff line number Diff line change 1
1
# Basic Stack
2
2
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 .
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ var Stack = module.exports = function () {
3
3
this . length = 0 ;
4
4
} ;
5
5
6
- Stack . prototype . add = function ( value ) {
6
+ Stack . prototype . push = function ( value ) {
7
7
var node = {
8
8
value : value ,
9
9
next : null
@@ -19,7 +19,7 @@ Stack.prototype.add = function (value) {
19
19
return this . length += 1 ;
20
20
} ;
21
21
22
- Stack . prototype . remove = function ( ) {
22
+ Stack . prototype . pop = function ( ) {
23
23
// If there is no head node, return `undefined`
24
24
if ( ! this . head ) { return ; }
25
25
You can’t perform that action at this time.
0 commit comments