Javascript Articles

Page 268 of 534

Doubly linked lists in Javascript

Sai Teja Kotha
Sai Teja Kotha
Updated on 15-Mar-2026 2K+ Views

In this article, we are going to discuss a Doubly Linked List Class data structure in JavaScript. This is a linear data structure. Doubly linked lists are almost the same as a singly linked list in all operations, we just need to keep track of one extra link per node. In singly linked lists, we just had next links, in doubly linked lists, we have 2 links, next and prev. Structure of Doubly Linked List Doubly linked lists are represented as: ...

Read More

Hash Table Data Structure in Javascript

Samual Sam
Samual Sam
Updated on 15-Mar-2026 2K+ Views

Hash Table is a data structure which stores data in an associative manner. In a hash table, data is stored in an array format, where each data value has its own unique index value. Access to data becomes very fast if we know the index of the desired data. Thus, it becomes a data structure in which insertion and search operations are very fast irrespective of the size of the data. Hash Table uses an array as a storage medium and uses the hash technique to generate an index where an element is to be inserted or is to ...

Read More

Binary Tree in Javascript

Sai Subramanyam
Sai Subramanyam
Updated on 15-Mar-2026 314 Views

Binary Tree is a special data structure used for data storage purposes. A binary tree has a special condition that each node can have a maximum of two children. A binary tree has the benefits of both an ordered array and a linked list as search is as quick as in a sorted array and insertion or deletion operation are as fast as in the linked list. Here is an illustration of a binary tree with some terms that we've discussed below: A Root ...

Read More

Binary Search Tree in Javascript

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 502 Views

A Binary Search Tree (BST) is a specialized data structure where each node follows a specific ordering rule. A node's left child must have a value less than its parent's value, and the node's right child must have a value greater than its parent's value. 8 3 10 1 6 14 ...

Read More

Removing a node in a Javascript Tree

Nikhilesh Aleti
Nikhilesh Aleti
Updated on 15-Mar-2026 3K+ Views

In JavaScript, removing a node from a tree is a fundamental operation that requires handling different scenarios based on the node's structure. This article covers the three main cases for node deletion in Binary Search Trees (BST). Tree Structure and Traversal Overview A tree is a nonlinear data structure consisting of nodes connected by edges. Tree traversal retrieves and processes data from each node in a specific order: In-order traversal − Follows the path (Left → Root → Right) Pre-order traversal − Follows the path (Root → Left → Right) Post-order traversal − Follows the path ...

Read More

AVL Rotations in Javascript

Sai Subramanyam
Sai Subramanyam
Updated on 15-Mar-2026 497 Views

To balance itself, an AVL tree may perform the following four kinds of rotations: Left rotation Right rotation Left-Right rotation Right-Left rotation The first two rotations are single rotations and the next two rotations are double rotations. To have an unbalanced tree, we at least need a tree of height 2. With this simple tree, let's understand them one by one. Left Rotation If a tree becomes unbalanced when a node is inserted into the right subtree of ...

Read More

Depth-first search traversal in Javascript

Sai Subramanyam
Sai Subramanyam
Updated on 15-Mar-2026 4K+ Views

DFS visits the child vertices before visiting the sibling vertices; that is, it traverses the depth of any particular path before exploring its breadth. A stack (often the program's call stack via recursion) is generally used when implementing the algorithm. Following is how a DFS works − Visit the adjacent unvisited vertex. Mark it as visited. Display it. Push it in a stack. If no adjacent vertex is found, pop up a vertex from the stack. (It will pop up all the vertices from the stack, which do not ...

Read More

Topological sorting using Javascript DFS

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 2K+ Views

A topological sort or topological ordering of a directed graph is a linear ordering of its vertices such that for every directed edge UV from vertex u to vertex v, u comes before v in the ordering. This only makes sense in directed acyclic graphs (DAGs). There are many places where topological sort makes a lot of sense. For example, let's say you're following a recipe, in this, there are some steps that are prerequisites for going to the next steps. Similarly, during college when selecting courses, there are prerequisites for more advanced courses which themselves may be prerequisites ...

Read More

How to clone an object in JavaScript?

Nikhilesh Aleti
Nikhilesh Aleti
Updated on 15-Mar-2026 5K+ Views

An object is said to be an entity which has properties and types in it. Example, consider a Person as an object and it has properties like height, weight, age and salary. In the similar way JavaScript also have objects and their defined properties. An object in JavaScript is a complicated data type where it can store various data types in it. Let's consider this example below: const employee = { ...

Read More

Garbage collection(GC) in JavaScript?

Arnab Chakraborty
Arnab Chakraborty
Updated on 15-Mar-2026 2K+ Views

Memory management in JavaScript is much easier than in low-level languages like C or C++. Unlike low-level languages, JavaScript automatically detects which objects will be needed in later cases and which will be garbage that is occupying memory without any reason. In this article, we shall discuss how garbage collection (GC) works in JavaScript. There are a few important parts that we are going to discuss in detail: Reachability from root Interlinked Objects (interconnections between different objects) Unreachable Collections (Broken link) Reachability The first concept of ...

Read More
Showing 2671–2680 of 5,340 articles
« Prev 1 266 267 268 269 270 534 Next »
Advertisements