diff --git a/book.json b/book.json index 4614a850c..63429dfa0 100644 --- a/book.json +++ b/book.json @@ -206,6 +206,10 @@ "lang": "kotlin", "name": "Kotlin" }, + { + "lang": "ts", + "name": "TypeScript" + }, { "lang": "vim", "name": "VimL" diff --git a/contents/stacks_and_queues/stacks_and_queues.md b/contents/stacks_and_queues/stacks_and_queues.md index 17b8b75b2..11c7088f7 100644 --- a/contents/stacks_and_queues/stacks_and_queues.md +++ b/contents/stacks_and_queues/stacks_and_queues.md @@ -13,6 +13,20 @@ For the most part, though, queues and stacks are treated the same way. There mus 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. +## Example Code +Here is a simple implementation of a stack: +{% method %} +{% sample lang="ts" %} +[import, lang:"typescript"](code/typescript/stack.ts) +{% endmethod %} + +Here is a simple implementation of a queue: +{% method %} +{% sample lang="ts" %} +[import, lang:"typescript"](code/typescript/queue.ts) +{% endmethod %} + + ## License ##### Code Examples