Skip to content

Commit

Permalink
data structures by example
Browse files Browse the repository at this point in the history
  • Loading branch information
bgoonz committed Mar 30, 2022
1 parent c749a15 commit 1ef10b2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
6 changes: 2 additions & 4 deletions src/pages/docs/ds-algo/ds-by-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ template: docs

# Data Structures


<details>

<summary>All Code From This Writeup</summary>
Expand Down Expand Up @@ -282,7 +281,6 @@ module.exports = {

```


</details>
---

Expand Down Expand Up @@ -1486,8 +1484,8 @@ if (this.root === null) {
- -^--^--^--^--^--^--^-
- 1 2 3 4 5 6 7
- This is how a binary tree works. Each node can have two children:
- Left: Less than parent node's value.
- Right: Greater than parent node's value.
- Left: Less than parent node's value.
- Right: Greater than parent node's value.
- > Note: In order to make this work all values must be unique in the tree.
- This makes the traversal to find a value very efficient. Say we're trying to
- find the number 5 in our tree:
Expand Down
14 changes: 5 additions & 9 deletions src/pages/docs/ds-algo/ds-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ Nodes with linked child nodes are called internal nodes while those without chil

These search operations are highly efficient, as its search duration is dependent not on the number of nodes but on the number of levels down the tree.

![](https://www.educative.io/api/page/6094484883374080/image/download/4860454879887360)
![height of tree](https://www.educative.io/api/page/6094484883374080/image/download/4860454879887360)

This type of tree is defined by four strict rules:

Expand Down Expand Up @@ -152,9 +152,9 @@ Graphs are a relation-based data structure helpful for storing web-like relation

In the above example, each circle is a vertex, and each line is an edge. If produced in writing, this structure would look like:

_V = {a, b, c, d}_
`V = {a, b, c, d}`

_E = {ab, ac, bc, cd}_
`E = {ab, ac, bc, cd}`

While hard to visualize at first, this structure is invaluable in conveying relationship charts in textual form, anything from circuitry to train networks.

Expand All @@ -177,7 +177,7 @@ Disadvantages

Hash tables are a complex data structure capable of storing large amounts of information and retrieving specific elements efficiently. This data structure relies on the concept of key/value pairs, where the "key" is a searched string and the "value" is the data paired with that key.

![](https://www.educative.io/api/page/6094484883374080/image/download/6745911163092992) Each searched key is converted from its string form into a numerical value, called a hash, using a predefined hash function. This hash then points to a storage bucket -- a smaller subgroup within the table. It then searches the bucket for the originally entered key and returns the value associated with that key.
![key value pair](https://www.educative.io/api/page/6094484883374080/image/download/6745911163092992) Each searched key is converted from its string form into a numerical value, called a hash, using a predefined hash function. This hash then points to a storage bucket -- a smaller subgroup within the table. It then searches the bucket for the originally entered key and returns the value associated with that key.

Advantages

Expand Down Expand Up @@ -214,7 +214,7 @@ Problem statement: Implement a function `removeEven(arr)`, which takes an array

Input: An array of random integers

```
```txt
[1,2,4,5,10,6,3]
```

Expand All @@ -230,7 +230,6 @@ There are two ways you could solve this coding problem in an interview. Let's di

---


```js


Expand All @@ -253,7 +252,6 @@ This approach starts with the first element of the array. If that current elemen

---


```js


Expand Down Expand Up @@ -610,7 +608,6 @@ To solve this problem, we must min heapify all parent nodes. Take a look.
---
```js


Expand All @@ -636,7 +633,6 @@ function minHeapify(heap, index) {
---
```js


Expand Down

0 comments on commit 1ef10b2

Please sign in to comment.