Skip to content

Commit d2c937b

Browse files
authored
adding stack and queue code infrastructure (#839)
1 parent 5d9d89c commit d2c937b

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

book.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,10 @@
206206
"lang": "kotlin",
207207
"name": "Kotlin"
208208
},
209+
{
210+
"lang": "ts",
211+
"name": "TypeScript"
212+
},
209213
{
210214
"lang": "vim",
211215
"name": "VimL"

contents/stacks_and_queues/stacks_and_queues.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,20 @@ For the most part, though, queues and stacks are treated the same way. There mus
1313

1414
The notation for this depends on the language you are using. Queues, for example, will often use `dequeue()` instead of `pop()` and `front()` instead of `top()`. You will see the language-specific details in the source code under the algorithms in this book, so for now it's simply important to know what stacks and queues are and how to access elements held within them.
1515

16+
## Example Code
17+
Here is a simple implementation of a stack:
18+
{% method %}
19+
{% sample lang="ts" %}
20+
[import, lang:"typescript"](code/typescript/stack.ts)
21+
{% endmethod %}
22+
23+
Here is a simple implementation of a queue:
24+
{% method %}
25+
{% sample lang="ts" %}
26+
[import, lang:"typescript"](code/typescript/queue.ts)
27+
{% endmethod %}
28+
29+
1630
## License
1731

1832
##### Code Examples

0 commit comments

Comments
 (0)