Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles on Trending Technologies
Technical articles with clear explanations and examples
JavaScript Program for Clockwise rotation of Linked List
In JavaScript, a clockwise rotation of a linked list moves the last k elements to the front. This operation is commonly used in data structure manipulations and algorithm problems. Given a linked list and a rotation count k, we need to move the last k nodes to the beginning. For example, rotating 1 → 2 → 3 → 4 → 5 clockwise by 2 positions results in 4 → 5 → 1 → 2 → 3. Structure of Linked List First, we'll create a Node class and helper functions to build and display the linked list: ...
Read MoreJavascript Program for Range Queries for Frequencies of array elements
We are given an array that will contain integers and another array will be given that will contain the queries and each query represents the range that we are given by the leftmost and the rightmost index in the array and an element. For that range or the subarray, we have to find the frequency of the given element present in that range. The frequency of the elements means that we have to tell for each integer present in that range how many times it occurs. For example − If, the given array is: [5, 2, 5, 3, ...
Read MoreHow to store JavaScript functions in a queue and execute in that order?
In JavaScript, you may need to store functions in a queue and execute them in a specific order. Since JavaScript doesn't have a built-in queue data structure, we can use arrays with push() to enqueue functions and shift() to dequeue them. This pattern is useful for managing asynchronous operations, implementing task schedulers, or controlling execution flow in applications. Basic Queue Operations A function queue uses these core operations: Enqueue: Add function to the end using push() Dequeue: Remove and execute function from the front using shift() Execute: Call functions in First-In-First-Out (FIFO) order ...
Read MoreJavaScript program for Sort the given matrix
Sorting a given matrix using JavaScript is a fundamental operation in programming. Sorting is the process of arranging the elements of a collection or matrix in a particular order. It is essential to make searching and other operations more efficient. In this article, we will discuss how to sort a given matrix using the JavaScript programming language. Problem Statement Given an n x n matrix, we need to sort all elements so that the matrix follows "strict order" - each row is sorted in ascending order, and for any row i where 1 ≤ i ≤ n-1, ...
Read MoreHow to Filter Object by Values in Lodash?
Sometimes we are given an object and we want to extract only the key-value pairs that meet certain criteria. In this article, we are going to discuss how we can filter objects by values in Lodash. Prerequisite Lodash: Lodash is a popular JavaScript library used to deal with a variety of functions such as arrays, objects, strings, and more. Install Lodash We can install the Lodash library in the project by adding it via CDN or npm using the following command: npm install lodash Approaches to Filter Object ...
Read MoreJavaScript Program for Sorting a Linked List of 0s, 1s, And 2s
In this tutorial, we will learn the JavaScript program for sorting a linked list of 0s, 1s, and 2s. Sorting algorithms are essential for any programming language, and JavaScript is no exception. Sorting a linked list of 0s, 1s, and 2s is a common problem that developers encounter in coding interviews and real-world applications. So, let's dive in and explore how to sort a linked list of 0s, 1s, and 2s using JavaScript programming. What is Sorting? Sorting is the process of arranging elements in a specific order, either ascending or descending. It is a fundamental operation ...
Read MoreHow to Convert URL Parameters to JSON in JavaScript?
When working with URLs you will often encounter query parameters that add additional information to the base URL. It may be helpful for developers whenever they need to convert these URL parameters to JSON format, especially for reading and manipulating data. Here we will explore different methods to convert URL parameters to a JSON format in JavaScript including built-in methods and custom solutions using split, reduce, and regular expressions. Understanding URL Parameters URL parameters (query string) follow the ? character in a URL, with each key-value pair separated by &. Here's an example URL: https://example.com/page?name=Pankaj&age=20&city=Surat ...
Read MoreJavaScript Program for Removing Duplicates From An Unsorted Linked List
The linked list is a linear data structure that consists of nodes, and each node is stored in memory in a non-contiguous manner. Nodes are connected by storing the address of the next node. We are given a linked list that will contain some integers in a random manner and not in a sorted manner. The task is to find the elements of the linked list which are repeated and we have to remove the duplicated ones. In this problem, we will keep the first copy of the elements of the linked list and remove the elements which are ...
Read MoreJavaScript Program to Check if it is possible to make array increasing or decreasing by rotating the array
Rotation of the array means to assume the array as a circular array and rotate the elements of the array to either their left or right direction by one index at each rotation and the element at one end may take the value present at another end. An Increasing array means that each element will be greater than or equal to its previous element and decreasing array means each element will be less than or equal to the previous element. In this problem, we are given an array and we can rotate the array in either the left or ...
Read MoreAdvanced Functional Reactive Programming (FRP) with JavaScript and RxJS
Functional Reactive Programming (FRP) is a powerful paradigm that combines functional programming concepts with reactive programming. By leveraging FRP, developers can build highly responsive and scalable applications by modeling the flow of data and events as streams of values. JavaScript, being a widely used language for web development, can benefit from FRP through libraries and frameworks. One popular library is RxJS (Reactive Extensions for JavaScript), which provides a rich set of tools for implementing FRP in JavaScript. In this article, we will explore advanced techniques of Functional Reactive Programming using JavaScript and RxJS. Understanding FRP and Reactive Programming ...
Read More