Photo by Mark Fletcher-Brown on Unsplash

# Data structure in JS

## Data structures for interview's quick peek

I've covered the basic data structure that has been provided by JS in this blog. You can find more about it here. In this blog, I'll focus on DS, that we have to write from scratch that JS doesn't give it to us

## Array

Implement flat without recursion

## Array vs Linked-List

## Linked List

💡

Used for twitter feeds

API

Concept

Advantages

## Stack

Overview

Valid parentheses problem?

## Queue

Overview

Implementation

## Tree

Normal tree

Use-case

## Binary tree

💡

Just to say it in front, I don't see much usage of binary trees in real life. Maybe there's just a question for the interview

Overview

Implementation ideas

### DFS (depth-first-search)

Overview

Ideas

### BFS (breadth-first-search)

Ideas

### Compare two binary tree

Idea

## Heap

Min-heap overview

Heap-up

Manage binary tree in the state of array

💡

Why do we have to use arrays? Because accessing the top element of an array is a 0(1). So it looks like a tree but is implemented as an array

Implementation idea

## Graph

Overview

### BFS on Adjacent Matrix

**Idea**

```
console.log(bfs(graph, 0, 4));
// [ 0, 1, 2, 3, 4 ]
```

More complex scenes

### DFS on the Adjacent-List

Represent **graph in Adjacent-List**

## Dijkstra

## LRU (Least Recent Used)

**Ideas**

**Implementation**