Articles on Trending Technologies

Technical articles with clear explanations and examples

How to multiply all values in a list by a number in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 4K+ Views

To multiply all values in a list by a number, we can use lapply function. Inside the lapply function we would need to supply multiplication sign that is * with the list name and the number by which we want to multiple all the list values. For example, if we have a list called LIST and we want to multiply each value in LIST by 2 then it can be done by using the command lapply(LIST,"*",2).Example1List1

Read More

Write a Golang program to find odd and even numbers using bit operation

Kiran P
Kiran P
Updated on 11-Mar-2026 591 Views

ExamplesInput num = 5 => 101 & 1 = 001 => True, i.e., Odd; else num would be Even.Approach to solve this problemStep 1: Define a method that accepts a number.Step 2: Perform & operation with that number.Step 3: If the & operator returns a non-zero value, then that number would be odd.Step 4: Else, the number would be even.Programpackage main import "fmt" func oddEven(num int){    if num & 1 != 0 {       fmt.Println("ODD")    } else {       fmt.Println("EVEN")    } } func main(){    oddEven(13)    oddEven(50)    oddEven(0) }OutputODD EVEN EVEN

Read More

How to find the sum of rows, columns, and total in a matrix in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 11K+ Views

To find the sum of row, columns, and total in a matrix can be simply done by using the functions rowSums, colSums, and sum respectively. The row sums, column sums, and total are mostly used comparative analysis tools such as analysis of variance, chi−square testing etc.Example1M1

Read More

Delete leaf nodes with value as x in C++ Program

Hafeezul Kareem
Hafeezul Kareem
Updated on 11-Mar-2026 1K+ Views

In this tutorial, we are going to learn how to delete the leaf nodes from a tree with the given value.Let's see the steps to solve the problem.Write a struct Node for a binary tree.Write a function to traverse (inorder, preorder, postorder) through the tree and print all data.Initialize the tree by creating nodes with the struct.Initialize the x value.Write a function to delete the leaf nodes with the given value. It accepts two arguments root node and x value.If the root is a null return.Replace the left node of the root with a new root after deletion.Same with the ...

Read More

Write a program in C++ to find the most frequent element in a given array of integers

Dev Prakash Sharma
Dev Prakash Sharma
Updated on 11-Mar-2026 4K+ Views

Let’s suppose we have an array of integers of size N. The task is to find the most frequent element present in the given array of integers. For example, Input-1 −N = 8 A[ ] = {1, 2, 4, 3, 3, 1, 1, 5}Output −1Explanation − In the given array of integers, the most appearing number is ‘1’. Thus the output is ‘1’.Input-2 −N = 6 A[ ] = {1, 4, 4, 4, 1, 1}Output-a −1Output-b −4Explanation: In the given array of integers, the most appearing number is ‘1’ and ‘4’. Thus we can return the output to any one ...

Read More

How to use column index instead of column name while using group_by of dplyr in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 1K+ Views

When we use group_by function of dplyr package, we need to pass the column name(s) that are categorical in nature. If we want to use the index of the same column(s) then group_by_at function needs to be used, where we can pass the column index as the argument.Example1y1

Read More

Delete leaf nodes with value k in C++ program

Hafeezul Kareem
Hafeezul Kareem
Updated on 11-Mar-2026 193 Views

In this tutorial, we are going to learn how to delete the leaf nodes from a tree with the given value.Let's see the steps to solve the problem.Write a struct Node for a binary tree.Write a function to traverse (inorder, preorder, postorder) through the tree and print all data.Initialize the tree by creating nodes with the struct.Initialize the x value.Write a function to delete the leaf nodes with the given value. It accepts two arguments root node and k value.If the root is a null return.Replace the left node of the root with a new root after deletion.Same with the ...

Read More

Delete middle of linked list in C++ program

Hafeezul Kareem
Hafeezul Kareem
Updated on 11-Mar-2026 4K+ Views

In this tutorial, we are going to learn how to delete the middle node in a linked list.The solution to the problem is straightforward. We will have two pointers one moves one node at a time and the other one moves two nodes at a time. By the time the second pointer reaches the final node, the first will be in the middle of the linked list.Let's see the steps to solve the problem.Write a struct Node for the linked list node.Initialize the linked list with the dummy data.Write a function to delete the linked list.Initialize two-pointers (slow and fast) ...

Read More

How to perform rounding in R to next 10 instead of nearest 10?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 317 Views

In general, most commonly used rounding is rounding to nearest 10 or nearest 100 but sometimes we actually want to remove the values after a value instead of rounding. For example, removing values after 2 decimal places, this is the type of situation where we need to round to next 10 instead of nearest 10. This can be done with the help of floor function as shown in the below examples.Example1x1

Read More

Delete N nodes after M nodes of a linked list in C++ program

Hafeezul Kareem
Hafeezul Kareem
Updated on 11-Mar-2026 919 Views

In this tutorial, we are going to learn how to delete N nodes after M nodes in a linked list.Let's see the steps to solve the problem.Write a struct Node for the linked list node.Initialize the linked list with the dummy data.Write a function to delete N nodes after M nodes.Initialize a pointer with the head pointer.Iterate till the end of the linked list.Move the pointer to the next node until M nodes.Delete the N nodesMove the pointer to the next nodePrint the linked listExampleLet's see the code.#include using namespace std; struct Node {    int data;    Node ...

Read More
Showing 25701–25710 of 61,297 articles
Advertisements