Javascript Articles

Page 35 of 534

Count the number of nodes in a complete Binary tree using JavaScript

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

A binary tree is a non-linear data structure where each node can have at most two children: left and right. In this article, we'll explore how to count nodes in a complete binary tree using JavaScript. What is a Complete Binary Tree? A complete binary tree is a binary tree where all levels are completely filled except possibly the last level, and the last level has all nodes filled from left to right. 1 ...

Read More

JavaScript Program to Find the Lost Element from a Duplicated Array

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

To find the lost element from a duplicated array in JavaScript, we will be discussing various approaches. Prerequisites to solve this problem include understanding of JavaScript arrays, loops, Set object, and binary search. In this article we have two arrays where one array is a duplicate of the other with one missing element. Our task is to find the lost element from the duplicated array in JavaScript. Problem Statement Given two arrays where the second array is missing exactly one element from the first array, we need to identify that missing element. Input: array1 = ...

Read More

JavaScript Program for Counting Frequencies of Array Elements

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

Counting frequencies of array elements means determining how many times each element appears in an array. This is a common programming task useful for data analysis, statistics, and various algorithms. JavaScript provides multiple approaches to solve this problem efficiently. In this article, we'll explore five different methods to count element frequencies in JavaScript. Each approach has its own advantages - some prioritize simplicity, others performance, and some leverage built-in methods or external libraries. Approaches to Count Array Elements Frequencies Here are the five approaches we'll cover, each with detailed explanations and complete working examples: ...

Read More

JavaScript Program to Find Lexicographically minimum string rotation

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

To find lexicographically minimum string rotation in JavaScript, we will understand two different approaches in this article. A lexicographically minimum rotation of a string is the smallest string that can be obtained by rotating the original string any number of times in lexicographical order. By lexicographical order it means dictionary order such as: a < b, ab < ac. In this article we are having a string. Our task is to write a JavaScript program to find lexicographically minimum string rotation. Example Input: bba All lexicographical order are: bba, bab, abb Output: Smallest lexicographical ...

Read More

JavaScript Program for Counting sets of 1s and 0s in a binary matrix

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

Counting sets of 1s and 0s in a binary matrix can be achieved using nested for loops with conditional statements. A binary matrix is a matrix that consists of only two digits: 1 and 0. In this article, we will write a JavaScript program for counting the sets of 1s and 0s in a given binary matrix by counting non-empty subsets in each row and column. Understanding the Formula For any set with n elements, the total number of non-empty subsets is 2^n - 1. Let us consider a set {a, b} having 2 elements ...

Read More

JavaScript Program for Maximum and Minimum in a Square Matrix

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

To get maximum and minimum in a Square Matrix in JavaScript, we will be discussing two different approaches, their complexities, and example codes. The first approach uses nested loops while the second approach uses Math functions. In this article we are having a 2D square matrix, our task is to write a JavaScript program for maximum and minimum in a square matrix. Problem Statement Input: Matrix: [ [1, 3, 7], [5, 2, 9], [2, 5, 1] ] Output: Maximum ...

Read More

JavaScript Program to Efficiently Compute Sums of Diagonals of a Matrix

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

In a square matrix, there are two main diagonals: the primary diagonal (left-to-right) and the secondary diagonal (right-to-left). Computing their sums efficiently is a common programming task with practical applications in linear algebra and image processing. In this article, we will explore two JavaScript approaches to calculate diagonal sums: a brute force method using nested loops and an optimized single-loop solution. 3x3 Matrix Diagonals ...

Read More

JavaScript Program for Diagonally Dominant Matrix

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

A diagonally dominant matrix is a square matrix where the absolute value of each diagonal element is greater than or equal to the sum of absolute values of all other elements in that row. In this article, we'll write a JavaScript program to check if a given matrix is diagonally dominant. This requires understanding 2D arrays, nested loops, and conditional statements. Diagonally Dominant Matrix Example ...

Read More

JavaScript Program for Number of Local Extrema in an Array

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

JavaScript Program for the Number of local extrema in an array is a common problem in the field of computer science and data analysis. Local extrema are the peaks and valleys in a sequence of numbers. In this article we are having two arrays, our task is to write a Javascript program for number of local extrema in an array. Local Extrema in Array [1, 2, 3, 2, 1, 4, 5, 6, 5, 4, 3, 2, 1] ...

Read More

How to create a reporting app with Vue 3 and Composition API?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 802 Views

Vue 3 with Composition API provides a powerful way to build reporting applications. This tutorial demonstrates creating a data-driven report table that fetches information from an external API and displays it in a structured format. What is a Reporting App? A reporting app displays data in organized formats like tables, charts, or dashboards. It transforms raw data into meaningful insights for users to analyze business metrics, user statistics, or any structured information. Composition API Benefits The Composition API allows logic-based component organization instead of lifecycle-based structure. This approach creates more maintainable, reusable, and testable code by ...

Read More
Showing 341–350 of 5,340 articles
« Prev 1 33 34 35 36 37 534 Next »
Advertisements