Javascript Articles

Page 8 of 534

JavaScript Program to Check if a Matrix is Symmetric

Prabhdeep Singh
Prabhdeep Singh
Updated on 15-Mar-2026 800 Views

A symmetric matrix is a square matrix that equals its transpose, meaning element at position (i, j) equals element at position (j, i). In mathematical terms, A = AT, where A is the matrix and AT is its transpose. In this article, we'll explore JavaScript programs to check if a given matrix is symmetric using different approaches. Original Matrix A 1 ...

Read More

JavaScript Program to Find Difference Between Sums of Two Diagonals

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 602 Views

To find difference between sums of two diagonals, we will be discussing two different approaches. We will calculate the sum of the elements present in the left and right diagonal, then we will subtract both sum values to get the difference. In this article we are having a square matrix, our task is to write a JavaScript program to find difference between sums of two diagonals. ...

Read More

JavaScript Program to Check horizontal and vertical symmetry in binary matrix

Alshifa Hasnain
Alshifa Hasnain
Updated on 15-Mar-2026 582 Views

In this article, we will learn to create a program to check both horizontal and vertical symmetry in a binary matrix in JavaScript. A binary matrix is a 2-D array that consists of one and zero only as the elements in each cell. Horizontal symmetry of a binary matrix means if the first row is the same as the last row, the second row is the same as the second last row, and so on. What are Symmetry Matrices? Symmetry in matrices refers to how the values in the matrix mirror themselves along an axis. In the ...

Read More

JavaScript Program to Cyclically Rotate an Array by One

Prabhdeep Singh
Prabhdeep Singh
Updated on 15-Mar-2026 564 Views

To cyclically rotate an array by one means shifting the value present at each index to their left or right by one. In this article, we are having an array and our task is to write a JavaScript program to cyclically rotate an array by one. Users must be familiar with JavaScript loops and array operations. Original Array: 1 2 3 ...

Read More

JavaScript Program for Inserting a Node in a Linked List

Prabhdeep Singh
Prabhdeep Singh
Updated on 15-Mar-2026 1K+ Views

A linked list is a linear data structure where elements (nodes) are stored in sequence, with each node containing data and a reference to the next node. Unlike arrays, linked lists allow efficient insertion and deletion at any position without shifting elements. In this article, we'll explore how to insert nodes into a linked list using JavaScript, covering insertion at the beginning, specific positions, and the end of the list. Basic Node Structure First, let's define a simple Node class that represents each element in our linked list: class Node { ...

Read More

JavaScript Program for Finding Length of a Linked List

Prabhdeep Singh
Prabhdeep Singh
Updated on 15-Mar-2026 623 Views

To find the length of a linked list in JavaScript, we need to count how many nodes are present. A linked list is made up of nodes, where each node contains data and a reference to the next node. The length is determined by starting at the head and counting each node until the end of the list. If the list is empty, the length should be 0. Our task is to write a JavaScript program that calculates the length of a linked list. In other words, we need to find out how many nodes are in the list. ...

Read More

C++ program to find the sum of elements between two given indices in array

AYUSH MISHRA
AYUSH MISHRA
Updated on 15-Mar-2026 5K+ Views

Finding the sum of elements between two given indices in an array is a common operation in programming. In C++, there are multiple ways to calculate the sum of elements between two given indices in C++. In this article, we are going to discuss various approaches to calculating the sum of elements between two indices in an array using C++. How to Find the Sum of Elements Between Two Indices? In this problem, we are given an array and two indices, L and R, and we have to find the sum of elements from index L and R ...

Read More

JavaScript Program for Equilibrium Index of an Array

Saurabh Anand
Saurabh Anand
Updated on 15-Mar-2026 898 Views

To write a JavaScript program for equilibrium index of an array, we are going to discuss three different approaches with detailed explanation and example codes. The equilibrium index of an array is the position where the sum of the elements to its left and right equals one another. In this article we are having an array of integers, our task is to write a JavaScript program for equilibrium index of an array. Example Input: arr = [-7, 1, 5, 2, -4, 3, 0] Output: Equilibrium index: 3 At index 3, left sum = -7 ...

Read More

JavaScript Program for Two Pointers Technique

Ravi Ranjan
Ravi Ranjan
Updated on 15-Mar-2026 2K+ Views

In this article we are given a sorted array, our task is to find if there exists any pair of elements such that their sum is equal to a given number. Users must be familiar with array, loop and nested loops, and if/else statement. Two Pointers Technique Two pointers technique is a commonly used algorithmic approach to solve various problems that require linear time complexity. This technique is used to find a solution for problems that involve searching, sorting, or manipulating arrays, strings, or linked lists. In this article, we are going to solve the pair sum problem using ...

Read More

JavaScript Program for the Third Largest Element in an Array of Distinct Elements

Ravi Ranjan
Ravi Ranjan
Updated on 15-Mar-2026 960 Views

For the third largest element in an array of distinct elements, we will discuss three different approaches. We will improve efficiency with each approach and discuss their complexities. In this article we are having an array of distinct elements, our task is to find third largest element in an array of distinct elements in Javascript. Users must be familiar with array, loops and conditional statement. Problem Statement Given an array of distinct elements, we need to find the third largest element efficiently. Input: arr = [2, 5, 8, 1, 4, 10, 7] => Highest: 10, ...

Read More
Showing 71–80 of 5,340 articles
« Prev 1 6 7 8 9 10 534 Next »
Advertisements