Server Side Programming Articles

Page 138 of 2108

Search an element in the given singly Linked List using C++

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

Given a singly linked list, the task is to search a particular element in the linked list. If the element is found, then print “present” otherwise “Not present”. For example, Input-1 −1→ 2→ 3→ 4→ 5→ 6Searching for ‘7’Output −Not PresentExplanation − In the given singly linked list the element ‘7’ is not present, hence we will return the output as “Not Present”.Input-2 −1→ 2→ 3→ 4→ 5Searching for ‘2’Output −PresentExplanation − Since in the given Singly linked list the element ‘2’ is present thus we will return the output as “Present”.Approach to solve this problemThere are two approaches to ...

Read More

Sort an arrays of 0’s, 1’s and 2’s using C++

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

Given an array of 0, 1, and 2, sort the elements in an order such that all the zeros come first before 1 and all the 2’s in the end. We have to sort all the elements of the array in-place.We can solve this problem using DNF (Dutch National Flag) Sorting Algorithm. For example, Input-1 −arr[ ]= {2, 0, 0, 1, 2, 1 }Output −0 0 1 1 2 2Explanation − Sorting the given array of elements containing 0, 1 and 2 using DNF Sorting Algorithm, it will print the output as {0, 0, 1, 1, 2, 2}.Input-2 −arr[ ]= ...

Read More

How to find the maximum value in an R data frame?

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

The maximum value is a part of summary statistics and we always need to understand the end limits of our data; therefore, it is highly required. If we have a data frame that contains numerical columns then the maximum value can be found by using max function and the data frame object name.Example1y1

Read More

Sort an arrays of 0’s, 1’s and 2’s using Java

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

Given an array of 0, 1 and 2 sort the element in an order such that all the zeros come first before 1 and all the 2’s in the end. We have to sort all the elements of the array in-place.We can solve this problem using DNF (Dutch National Flag) Sorting Algorithm. For example, Input-1 −arr[ ]= {2, 0, 0, 1, 2, 1 }Output −0 0 1 1 2 2Explanation − Sorting the given array of elements containing 0, 1 and 2 using the DNF Sorting Algorithm, it will print the output as {0, 0, 1, 1, 2, 2}.Input-2 −arr[ ...

Read More

How to change the font size of main title of boxplot in base R?

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

The font size of the main title of boxplot can be changed by defining the font size value using par(cex.main=”size”), here size value can be changed based on our requirement. This needs to be done before creating the boxplot, otherwise, there will be no effect on the size of the main title.Examplex

Read More

Square of a sorted array in C++

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

In the given array of sorted integers, the task is to print the squares of every array element and print the array in sorted order. For example, Input-1 −arr[ ] = { -3, -1, 0, 1, 4, 6 };Output −{0, 1, 1, 9, 16, 36}Explanation − The squares of each of the elements of the given array [-3, -1, 0, 1, 4, 6 ] is [0, 1, 1, 9, 16, 36 ].Input-2 −arr[ ]= { 0, 1, 2, 8, 9 }Output −{0, 1, 4, 64, 81}Explanation − The squares of each of the elements of the given array [ 0, ...

Read More

Valid Sudoku in C++

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

Let’s suppose we’ve given a 9×9 matrix called a Sudoku. The task is to check whether the given Sudoku Pattern is valid or not.In general, a Sudoku board look like this, Rules of Sudoku −Every row contains a number in the range 1-9Every column contains numbers in the range 1-9.Each block of 3×3 contains unique numbers in it.A particular row cannot have the same number.A particular column cannot have the same number.For ExampleInput-1 −sudoku[]=    [["3", "5", ".", ".", "2", ".", ".", ".", "."]    , ["7", ".", ".", "1", "6", "5", ".", ".", "."]    , [".", "9", "8", ...

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 find the position of NA in an R vector?

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

When we have NA’s/missing values in an R vector then we want to replace those NA’s and for this purpose we might be needing the position of those values. These positions will be helpful especially in situations when we want to manually replace the missing values. The replacement can be done by using which function with is.na.Example1x1

Read More

How to remove column names from an R data frame?

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

There are situations when we might want to remove column names such as we want to manually replace the existing column names by new names or we simply don’t want to use them if we are very much familiar with the column characteristics. To remove the columns names we can simply set them to NULL as shown in the below examples.Example1Consider the below data frame −set.seed(357) x1

Read More
Showing 1371–1380 of 21,074 articles
« Prev 1 136 137 138 139 140 2108 Next »
Advertisements