Skip to content

Commit ef511ad

Browse files
committed
Merge remote-tracking branch 'refs/remotes/buckyroberts/master'
2 parents 0e70b8f + 69325ee commit ef511ad

3 files changed

Lines changed: 34 additions & 13 deletions

File tree

Data_Structures/Stacks/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Stacks
22

3-
A stack is a basic data structure that can be logically thought as linear structure represented by a real physical
4-
stack or pile, a structure where insertion and deletion of items takes place at one end called top of the stack. The
5-
basic concept can be illustrated by thinking of your data set as a stack of plates or books where you can only take the
6-
top item off the stack in order to remove things from it.
3+
A stack is a data structure that can be logically thought of as a real physical stack or pile, a structure where
4+
insertion and deletion of items takes place at one end only called the "top" of the stack. The basic concept can be
5+
illustrated by thinking of your data set as a stack of plates or books where you can only take the top item off the
6+
stack in order to remove things from it.
77

88
![](http://i.imgur.com/dax54C9.jpg)

Data_Structures/Stacks/main.js

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
function Stack() {
44
let items = [];
55

6-
// remove all items in the stack
6+
// remove all items
77
this.clear = function () {
88
items = [];
99
};
@@ -13,25 +13,30 @@ function Stack() {
1313
return items.length == 0;
1414
};
1515

16-
// return last item added to stack
16+
// return last item added
1717
this.peek = function () {
1818
return items[items.length - 1];
1919
};
2020

21+
// remove last item from end
22+
this.pop = function () {
23+
return items.pop();
24+
};
25+
2126
// display all items
2227
this.print = function () {
2328
console.log(items.toString());
2429
};
2530

26-
// add item to end of stack
31+
// add item to end
2732
this.push = function (element) {
2833
items.push(element);
2934
};
3035

31-
// remove last item from stack
32-
this.pop = function () {
33-
return items.pop();
34-
}
36+
// get size of stack
37+
this.size = function () {
38+
return items.length;
39+
};
3540

3641
}
3742

@@ -42,7 +47,11 @@ buckysStack.push(87);
4247
buckysStack.push(29);
4348
buckysStack.push(71);
4449
buckysStack.print();
50+
51+
console.log('--------------------');
52+
4553
console.log(buckysStack.peek());
54+
console.log(buckysStack.size());
4655

4756
console.log('--------------------');
4857

README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
![](http://i.imgur.com/BgUMUGU.png)
1+
![](http://i.imgur.com/jVYUayw.png)
22

33
# Course Outlines
44

@@ -46,6 +46,8 @@ Teach existing JavaScript data structures such as arrays, sets, and maps. Also t
4646

4747
## ES6 Features
4848

49+
[Watch Video Tutorials](https://www.youtube.com/watch?v=ZJZfIw3P8No&index=1&list=PL6gx4Cwl9DGBhgcpA8eTYYWg7im72LgLt)
50+
4951
Overview of all the new features, syntax, and changes in ES6.
5052

5153
- let
@@ -58,8 +60,18 @@ Overview of all the new features, syntax, and changes in ES6.
5860

5961
***
6062

61-
### Using ES6
63+
## Using ES6
6264

6365
To enable ES6 support in any JetBrains IDE *(such as WebStorm)*:
6466
- File > Settings > Languages & Frameworks > JavaScript
6567
- Select EMCAScript 6
68+
69+
70+
## Links
71+
72+
- [Support](https://www.patreon.com/thenewboston)
73+
- [thenewboston.com](https://thenewboston.com/)
74+
- [Facebook](https://www.facebook.com/TheNewBoston-464114846956315/)
75+
- [Twitter](https://twitter.com/bucky_roberts)
76+
- [Google+](https://plus.google.com/+BuckyRoberts)
77+
- [reddit](https://www.reddit.com/r/thenewboston/)

0 commit comments

Comments
 (0)