Back to all posts

Data Structures in JavaScript


Data structures are the fundamental building blocks of computer science and programming. They enabled efficient storage, organization, and manipulation of data. This blog post aims to provide comprehensive understanding of various data structure and their applications.

Arrays

Arrays are one of the simplest and most commonly used data structures. They store a fixed-size sequence of elements of the same type, accessed using an index. we explore array operations, time complexities, and discuss their strengths and weaknesses.

Objects (Hash Tables)

In JavaScript, an object is a collection of key-value pairs. This data structures is also called map, dictionary or hash-table in other programming languages.

Stacks

Stacks follows the Last-In-First-Out(LIFO) principle. We discuss the concept of a stack, its operations (push, pop, peek), and examine real-world scenarios where stacks find applications

Queues

Queues adhere to the First-In-First-Out (FIFO) principle. We explore the concepr of a queue, its Operatios (enqueue, dequeue), and examine use cases where queues excel, such as process scheduling and breadth-first search.

Linked Lists

Linked lists offer dynamic memory allocation and efficient insertion/deletion operations. We discuss the basics of linked lists and explore two main types: singly linked lists and doubly linked lists, along with their advantages and trade-offs.

Trees

Trees are hierarchical data structures that mimic the structure of natural trees. We introduce tree and discuss their properties. Additionally, we explore binary trees, where each node has at most two children and heaps, which are specialized binary trees with specific ordering properties.

Graphs

Graphs represents relationship between entities and find application in various domains. We distinguish between undirected and directed graph and discuss weighted and unweighted graphs. we also delve into common graph algorithms like depth-first search(DFS) and breadth-first search (BFS).

Other Data Structures

In addition to the aforementioned structures, we touch upon other essential data structures like hash sets, hash maps, priority queues and more.