Found 10711 Articles for Web Development

JavaScript Program for Rotate a Matrix by 180 degrees

Prabhdeep Singh
Updated on 12-Apr-2023 12:25:24

212 Views

A square matrix is a kind of 2-D array with an equal number of rows and columns and we have to rotate the matrix by 180 degrees anticlockwise. Rotating a matrix anti-clockwise means first converting all the rows into columns and the first row will be the first column and then again rotating the rows into columns and the first row will be the first column and so on. Let’s see an example − Input 1: N = 3 Matrix = [ [1, 2, 3], [4, 5, 6], [7, 8, 9] ] Output 1: ... Read More

JavaScript Program For Reversing Alternate K Nodes In A Singly Linked List

Prabhdeep Singh
Updated on 12-Apr-2023 12:23:26

88 Views

Reversing a linked list means arranging all the nodes of the linked list in the opposite manner as they were present earlier or moving the elements present at the last of the linked list towards the head and head nodes towards the tail. Alternate K nodes reversing means reversing the first k elements and then keeping the next k elements the same and again reversing the next k elements and so on. We will see the codes with the different approaches and explanations for each of them. For example If the given linked list is the: 1 ... Read More

JavaScript Program For Reversing A Linked List In Groups Of Given Size

Prabhdeep Singh
Updated on 12-Apr-2023 12:22:20

133 Views

A linked list is a linear data structure that consists of interconnected nodes. Reversing a linked list means changing the order of all its elements. Reversing a linked list in groups of a given size means, we are given a number and we will reverse the first given number of elements, and then for the next set we will reverse the elements. We will see the proper code with implementation. Examples Given linked list: 1 -> 2 -> 3 -> 4 -> 5 -> 6 -> 7 -> 8 -> null Given number: 3 Output: 3 -> 2 -> ... Read More

JavaScript Program for Reversal algorithm for right rotation of an array

Prabhdeep Singh
Updated on 12-Apr-2023 12:21:05

146 Views

Right rotation of an array means to rotate the elements of the array to their right side by a given number of times and for the number which are present at the edge they will move to the first index in their right rotation by assuming an array in a cycle form. We will implement a proper code to implement the algorithm with an explanation. Example Let us assume we have given array as [1, 2, 3, 4, 5, 6, 7, 8, 9] The number of right rotations of the array is 3 Output: 7 8 9 1 2 ... Read More

JavaScript Program for Reversal algorithm for array rotation

Prabhdeep Singh
Updated on 12-Apr-2023 12:19:55

161 Views

An array is a linear data structure used to store the different types of objects and we are given an array of size n and an integer k (where k is the number by which we will rotate an array). We will rotate the array by k elements and then return the rotated array. Rotation means we have to traverse the array from the given kth element and shift all the integers by one and we have to shift each element by 1 till the kth element came to position ‘0’ or we can say at index number ‘0’. Note ... Read More

JavaScript Program for Removing Duplicates From An Unsorted Linked List

Prabhdeep Singh
Updated on 12-Apr-2023 12:18:55

174 Views

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. We will see the proper code and explanation. In this problem, we will keep the first copy of the elements of the ... Read More

Javascript Program For Removing Duplicates From A Sorted Linked List

Prabhdeep Singh
Updated on 12-Apr-2023 12:17:02

261 Views

Linked list is linear data structure and we have given a sorted linked list that consists of the integers. There are some numbers that may be duplicated or repeated and we have to remove them. As the given linked list is sorted, we can simply iterate over it and by using the while loop can remove the duplicate nodes from it. We will implement a proper code to understand the logic better with the discussion of time and space complexity. Example Given linked list is: 1-> 2 -> 2 -> 3 -> 4 -> 4 -> 4 -> 5 -> ... Read More

Javascript Program for Range Queries for Frequencies of array elements

Prabhdeep Singh
Updated on 12-Apr-2023 12:15:19

101 Views

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, 1, 5, ... Read More

How to set blur distance in CSS?

Shabaz Alam
Updated on 12-Apr-2023 09:08:08

224 Views

CSS (Cascading Style Sheets) is a powerful tool for designing the visual effects of a website. The blur effect is one of the many features in CSS, which is used to blur any element using the blur property. To create a soft, dreamy effect or to draw attention to a specific element on a page, we can use the blur effect. Syntax css element { filter : blur (amount) } The Concept of Blur Distance in CSS Before discussing the practical aspect of setting blur distance, it is important to understand the concept of blur distance. ... Read More

How to set background-image for the body element using CSS?

Shabaz Alam
Updated on 12-Apr-2023 09:06:52

234 Views

CSS (Cascading Style Sheets) is a powerful tool for designing the visual appearance of a website. The background-image property is one of the many features in CSS, which is used to set the background image using the background-image property. In web development, the background image is an important part of the overall design of a website. The default background of the body element in HTML is white, but with a few lines of CSS code, the background of a webpage can be changed to any image. Setting background-image in CSS Setting a background image is a great way to enhance ... Read More

Advertisements