uzzal71 / javascript-data-structure-algorithm

javascript data structure and algorithm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

What is data structure

A data structure is a way to store and organize data so that it can be used in effciently


A data structure is a collection of data values, the relationship among them, and the function or operations that can be applied to the data

Why learn data structures?

Almost every application we build involves data that is modelled in a certain way


To efficiently mange that data, you need data structures


Imagine walking info a libray only to find out there is no efficient organization of the books and they are stored randomly


The difference between a function taking a few milliseconds vs a few seconds or even minutes comes down to the selection of the right data structure


Data structures help your solve problem in a more efficient way, both in terms of time and memory


Learning about data structures also you gain a more profound understanding of things you're already aware of


Data structures help you solve problems in a more efficient way, both in terms of time and memory. Moreover, learning


about data structures gives you a deeper understanding of concepts you're already familiar with:

  • DOM: Modeled as a Tree data structure
  • Browser back and forward functionality: Implemented using a Stack data structure
  • Operating System job scheduling: Utilizes Queue data structure

Built-in Data Structures

  1. Arrays: Ordered collection of elements with constant-time access to individual elements using an index.
  2. Objects: Unordered collection of key-value pairs.
  3. Sets: Collection of unique elements with no duplicate values.
  4. Maps: Collection of key-value pairs where each key is unique.

Custom Data Structures

  1. Stacks: Collection of elements with Last-In-First-Out (LIFO) access.
  2. Queues: Collection of elements with First-In-First-Out (FIFO) access.
  3. Circular Queues: Variant of queues where the end points to the beginning, forming a circular structure.
  4. Linked Lists: Collection of nodes where each node points to the next node in the sequence.
  5. Hash Tables: Data structure that stores key-value pairs, allowing for fast retrieval based on keys.
  6. Trees: Hierarchical data structure consisting of nodes connected by edges, with one node designated as the root.
  7. Graphs: Collection of nodes (vertices) connected by edges (links), representing relationships between entities.

Learning and understanding these data structures is fundamental for building efficient and scalable software systems.

About

javascript data structure and algorithm

License:MIT License


Languages

Language:JavaScript 100.0%