Articles on Trending Technologies

Technical articles with clear explanations and examples

How to sort a large number of csv files in ascending order in R?

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

To sort a large number of csv files in ascending order, we can use mixedsort function from gtools package. For example, if we have a list of csv files that are randomly arranged in a vector called FILES then the files can be sorted in ascending order using the command mixedsort(sort(FILES))ExampleFiles1

Read More

C++ Program to find the Shortest Distance to a character

Dev Prakash Sharma
Dev Prakash Sharma
Updated on 11-Mar-2026 637 Views

Given a string 'a' and a character 'char', the task is to print the distance of 'char' from each character of the given string. The size of the distance array is same as the size of the string, since we have to find the distance of the character from each character of the given string.For ExampleInput-1:a = “tutorialspoint”char = “o”Output: [ 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3]Explanation: In the given string, the distance of the character from each character of the given string is [3, 2, 1, 0, 1, 2, 3, 4, 5, 6, ...

Read More

Create a new string by alternately combining the characters of two halves of the string in reverse in C++ Program

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

In this tutorial, we are going to write a program that creates a new string by alternately combining the characters of the two halves of the string in reverse order.Let's see the steps to solve the problem.Initialize the string.Find the length of the string.Store the first half and second half string indexes.Iterate from the ending of the two halves of the string.Add each character to the new string.Print the new string.ExampleLet's see the code.#include using namespace std; void getANewString(string str) {    int str_length = str.length();    int first_half_index = str_length / 2, second_half_index = str_length;    string new_string ...

Read More

How to create a sequence increasing by 1 in R?

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

If a sequence is increasing by 1 that means for every value the total number of values increases by that much. For example, the values 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 are creating a sequence of values starting from 1 to 5. To create such type of sequences in R, we can simply use sequence function and pass the range as sequence(1:5).Examplex1

Read More

Find the sum of left leaf nodes of a given Binary Tree in C++

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

Let us suppose we have a Binary Tree having a root node and its left child and right child. The task is to find the total sum of leaf nodes of the tree which are left to its parent node.For ExampleInput-1:      Output:15Explanation: In the given input Binary Tree, the sum of all the left leaf nodes is 9+4+2 = 15. So, the output is 15.Approach to Solve this ProblemWe have a Binary Tree and the task is to find the sum of all the leaf nodes which are left to its parent.The recursive approach to solve this problem is to ...

Read More

How to convert dot to comma for numerical columns in an R data frame?

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

Most European countries use a comma in place of a decimal. Therefore, if we have a data set that contains dot as a decimal market and we need to use that four such European countries or if dot is recorded in place of comma then we can replace the dot with comma using format function as shown in the below examples.Example1x2

Read More

How to display Y-axis with Euro sign using ggplot2 in R?

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

When we have a Euro currency column in an R data frame as a response variable then we might to display the Euro sign in the plot created by using ggplot2 package. For this purpose, we can use scales package and the scale for Y axis will be changed by using the command scale_y_continuous(labels=dollar_format(suffix="€",prefix="")) to the plot command.Consider the below data frame −Examplex

Read More

Intersection of Two Linked Lists in C++

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

A Linked List is a linear data structure in which each node has two blocks such that one block contains the value or data of the node and the other block contains the address of the next field.Let us assume that we have a linked list such that each node contains a random pointer which is pointing to the other nodes in the list. The task is to find the node at which two linked lists intersect each other. If they don't intersect, then return NULL or empty as output.For ExampleInput-1:             Output:2Explanation: Since the given linked ...

Read More

How to extract column names that do not have even one missing value in an R data frame?

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

The extraction of column names that do not have missing values can be done with the help of colnames function along with the complete.cases function. The complete.cases function will extract the columns that do not have missing values then colnames will extract those column names only.Example1Consider the below data frame −x1

Read More

How to truncate a string vector after a character in R?

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

The most difficult problem in data analysis is cleaning a dirty data. Most of the times the data is available in dirty form and one such dirtiness is a string vector having unnecessary values after a particular character. Therefore, to truncate a string vector after a character we can use str_split from stringr package along with the sapply function as shown in the below examples.library(stringr)Examplex1

Read More
Showing 25471–25480 of 61,297 articles
Advertisements