Articles on Trending Technologies

Technical articles with clear explanations and examples

How to compare two columns in an R data frame for an exact match?

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

Sometimes analysis requires the user to check if values in two columns of an R data frame are exactly the same or not, this is helpful to analyze very large data frames if we suspect the comparative values in two columns. This can be easily done with the help of ifelse function.ExampleConsider the below data frame −x1

Read More

First triangular number whose number of divisors exceeds N in C++

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

In this tutorial, we are going to find a triangular number whose number of divisors are greater than n.If the sum of natural numbers at any point less than or equal to n is equal to the given number, then the given number is a triangular number.We have seen what triangular number is. Let's see the steps to solve the problem.Initialize the numberWrite a loop until we find the number that satisfies the given conditions.Check whether the number is triangular or not.Check whether the number has more than n divisors or not.If the above two conditions are satisfied then print ...

Read More

How to identify duplicate values in a column of matrix in R?

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

We can easily identify duplicate values in a matrix by using duplicated function but it does not specify that the first occurrence is also duplicated. Therefore, we need to use it with OR sign | and the argument fromLast = TRUE of duplicated function so that the first occurrence of the duplicated values will be also identified as duplicate.ExampleM1

Read More

Program to find minimum sum of difficulties to complete jobs over k days in C++

Arnab Chakraborty
Arnab Chakraborty
Updated on 11-Mar-2026 250 Views

Suppose we have a list of numbers called jobs and another value k. Now we want to finish all jobs in k different days. The jobs must be performed in the given order and in each day we have to complete one task. The difficulty of job i is stored at jobs[i] and the difficulty of completing a list of jobs on a day will be the maximum difficulty job performed on that day. So we have to find the minimum sum of the difficulties to perform the jobs over k different days.So, if the input is like jobs = ...

Read More

First uppercase letter in a string (Iterative and Recursive) in C++

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

In this tutorial, we are going to learn how find the first uppercase letter in the given string. Let's see an example.Input −TutorialspointOutput −TLet's see the steps to solve the problem using iterative method.Initialize the string.Iterate over the string.Check whether the current character is uppercase or not using isupper method.If the character is uppercase than return the current character.ExampleLet's see the code.#include using namespace std; char firstUpperCaseChar(string str) {    for (int i = 0; i < str.length(); i++)       if (isupper(str[i])) {          return str[i];       }       return ...

Read More

How to create side by side histograms in base R?

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

To create side by side histograms in base R, we first need to create a histogram using hist function by defining a larger limit of X-axis with xlim argument. After that we can create another histogram that has the larger mean and smaller standard deviation so that the bars do not clash with each other and add=T argument must also be added inside the second hist function.Examplehist(rnorm(5000,mean=5,sd=2.1),col="green",xlim=c(1,20))OutputExamplehist(rnorm(5000,mean=15,sd=1.25),col="red",add=T)Output

Read More

Program to justify a set of words by converting them into same length lines in C++

Arnab Chakraborty
Arnab Chakraborty
Updated on 11-Mar-2026 146 Views

Suppose we have an list of words and a width k, we have to arrange the text such that each line has exactly k number of characters and the text is fully justified. Here we shall pack our words as many words as we can insert in each line. And we shall pad extra spaces ' ' when necessary so that each line has exactly k characters.Here extra spaces between words should be distributed as evenly as possible. If the number of spaces on a line do not divide evenly between words, empty slots on the left will be assigned ...

Read More

Fixed (or static) Partitioning in Operating System in C++

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

In this tutorial, we are going to learn about the fixed partitioning in the operating system.Fixed partitioning is one to manage the memory in operating system. It's an old technique. It divides the memory into equal blocks. The size of each block is predefined and can not be changed.The memory is used for the contiguous processes.ExampleLet's see the sample program that allocates memory based on the process size.#include using namespace std; int main() {    int blockNumber = 5, processesNumber = 3;    int blockSize[5] = {4, 4, 4, 4, 4}, processSize[3] = {1, 2, 3};    int flags[5], allocation[5]; ...

Read More

How to convert NA's in sequence to a single NA in an R vector?

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

Sometimes values are missing in a sequence and R program records them as NA (Not Available). In this type of situation, we might want to replace consecutive NA records with single NA value. This can be done by using is.na along with diff function as shown in the below examples.Examplex1

Read More

How to find the range for 95% of all values in an R vector?

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

The range for 95% of all values actually represents the middle 95% values. Therefore, we can find the 2.5th percentile and 97.5th percentile so that the range for middle 95% can be obtained. For this purpose, we can use quantile function in R. To find the 2.5th percentile, we would need to use the probability = 0.025 and for the 97.5th percentile we can use probability = 0.0975.Examplex1

Read More
Showing 25741–25750 of 61,297 articles
Advertisements