Skip to content

Commit

Permalink
Stacks
Browse files Browse the repository at this point in the history
  • Loading branch information
mesirendon committed Jul 28, 2024
1 parent 7ea5a7c commit 89b67ce
Show file tree
Hide file tree
Showing 15 changed files with 657 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .nycrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": "@istanbuljs/nyc-config-babel"
"extends": "@istanbuljs/nyc-config-babel"
}
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,41 +16,53 @@ JavaScript is also a flexible language that allows performing actions that could
Read all the content of [**Data Structures and Algorithms** here](./content.md)

## Using this repository

### Prerequisites

You will need to have node installed. I recommend using the [nvm installer script](https://github.com/nvm-sh/nvm#install--update-script), and following their [instructions](https://github.com/nvm-sh/nvm#usage). I recommend using the `v20.12.2` version.

### Clone

```bash
git clone git@github.com:mesirendon/datastructures-and-algorithms-js.git
```

### Install dependencies

```bash
npm ci
```

### Run tests

#### All Tests

Running all tests will show a coverage report.

```bash
npm t
```

#### Specific

```bash
npm run test:case src/singly-linked-lists/__test__/linked-lists.spec.js
```

### Start the app

You can use the provided index.js as a playground by running in a console the following command.

```bash
npm start
```

When you modify the [index.js](./index.js) file and save it, the service will be reloaded.

## Disclaimer ⚠️

This repository is meant to be used as an educational and research tool. Therefore, you should think twice before copying and pasting the code seen here in your production developments. Also, remember this code is licensed under [MIT License](./LICENSE), thus limiting any warranty or liability for its use.

## Acknowledgement

[Trekhleb](https://github.com/trekhleb)'s [JavaScript Algorithms](https://github.com/trekhleb/javascript-algorithms) repository heavily inspires this repository.
4 changes: 1 addition & 3 deletions babel.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
],
"env": {
"test": {
"plugins": [
"istanbul"
]
"plugins": ["istanbul"]
}
}
}
7 changes: 7 additions & 0 deletions content.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,11 @@
- [Queue Wrapper](./src/data-structures/queues/Queue.js)
- Tests
- [Queue Node and Queue Wrapper](./src/data-structures/queues/__test__/queue.spec.js)
- [Stack](./src/data-structures/stack/Stack.ipynb)
- Implementation
- [Stack Node](./src/data-structures/stack/StackNode.js)
- [Stack Wrapper](./src/data-structures/stack/Stack.js)
- Tests
- [Stack Node and Stack Wrapper](./src/data-structures/stack/__test__/stack.spec.js)
- **TODO:** List of exercises
- **TODO:** Applications?
1 change: 1 addition & 0 deletions src/data-structures/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[Back to Content](../../content.md)

# Data Structures

Data is a broad term that could mean any type of information. Structuring such information is related to organizing and storing it for future access or manipulation in an efficient manner.

**Note on exercises**: I'm not using the actual implementation here because
Expand Down
2 changes: 1 addition & 1 deletion src/data-structures/queues/QueueNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default class QueueNode {

/**
* Returns a string representation of this node.
*
*
* Could be specified through a function.
* @param {function} customFn Custom stringifier
* @returns {string} This node string representation
Expand Down
2 changes: 1 addition & 1 deletion src/data-structures/queues/Queues.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@
"| Peek | $O(1)$ |\n",
"\n",
"## Space Complexity\n",
"Linked lists have $O(n)$ space complexity.\n",
"Queues have $O(n)$ space complexity.\n",
"\n",
"## Bibliography\n",
"1. JavaScript Data Structures and Algorithms[^1]\n",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[Back to Content](../../../../content.md)

# Singly Linked Lists Exercises

The following are some proposed exercises that use the concepts learned with Singly Linked Lists.

- [Merge Two Sorted Lists (as nodes)](./merge-two-sorted-lists/index.ipynb)
Expand Down
Loading

0 comments on commit 89b67ce

Please sign in to comment.