
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 26504 Articles for Server Side Programming

11K+ Views
To check if any value in an R vector is greater than or less than a certain value, we can use any function.For Example, if we have a vector called V and we want to check if any value in V is greater than 100 then we can use the command given below −any(V>100)Similarly, we can check if any value is less than 100 by using the command as follows −any(V

8K+ Views
Bubble Sort is one of the simplest sorting algorithms used to sort data by comparing the adjacent elements. All the elements are compared in phases. The first phase places the largest value at the end, the second phase places the second largest element at the second last position and so on till the complete list is sorted.Bubble Sort Algorithmint arr[5]= { 5, 4, 2, 1, 3 };int i, j ;Traverse from index i=0 to iarr[j] swap arr[i] with arr[j]EndRecursive Bubble SortIf array length is 1 then returnTraverse array once and fix largest element at the endRecursively perform step 2 for ... Read More

745 Views
To find the sum product of two matrix by row in R, we can use rowSums function by passing the multiplication of the matrices.For example, if we have two matrices say Matrix1 and Matrix2 then, the sum product of these two matrices by row can be found by using the following command −rowSums(Matrix1*Matrix2)Example 1Following snippet creates a matrix −M1

9K+ Views
To multiply each value in a column by a constant, we can use multiplication sign *.For example, if we have a data frame called df that contains a column say x. Now, if we want to multiply each value in x with 10 then we can use the below mentioned command −df$x

395 Views
We are given a string type variable, let's say, str which will be used to store the source code then calculate the size of the string and pass it to the function. The task is to rearrange the given source code and then print the result.Let us see various input output scenarios for this −Input − string str ="#include using namespace std; int main()" "{ int sum, first, second; sum = first + second; printf(\"%d\", c);" " return 0;}"Output −#include using namespace std; int main(){ int sum, first, second; sum = first + second; printf("%d", ... Read More

4K+ Views
The error invalid xlim value occurs when we incorrectly provide the xlim values, these values are not used in sequence, we just need to provide first and the last value. For Example, if we want to create a point chart of 1 to 5 with xlim having values between -5 to 15 then we can use the command as follows −plot(1:5, xlim=c(-5:15))ExampleAdd the following code to the above command −plot(1:10) OutputIf you execute the above given command, it generates the following Output −Add the following code to the above snippet −plot(1:10) plot(1:10, xlim=c(-15:15)) Error in plot.window(...) : invalid 'xlim' value ... Read More

3K+ Views
To create histogram for discrete column in an R data frame, we can use geom_bar function of ggplot2 package and set the width to 1 also passing same column for x and y in aes.For example, if we have a data frame called df that contains a discrete column say x then the histogram for data in x can be created by using the below given command −ggplot(df,aes(x,x))+geom_bar(stat="identity",width=1)ExampleFollowing snippet creates a sample data frame −x

311 Views
We are given with a string ‘str’ of any given length. The task is to rearrange the characters in such a manner that there will be maximum substrings that will be a palindrome string without adding or removing a character from the given input string. Palindrome string is the one in which the characters are arranged in such a manner that they pronounce the same from start and last.Let us see various input output scenarios for this −Input − string str = "itnin"Output − Rearrangement of the string to maximize the number of palindromic substrings is: iinnt.Explanation − We are given a string ... Read More

377 Views
We are given an integer type number, let's say, number. The task is to rearrange number digit’s in such a manner that a number formed after rearrangement is also divisible by the given number i.e. ’number’.Let us see various input output scenarios for this −Input − int number = 100035Output − Rearrangement of a number which is also divisible by it is: 300105Explanation − we are given an integer number as ‘number’ i.e. 100035. Now, the task is to rearrange these given digits in such a manner that the formed number will be divisible by 100035. So, after rearranging the digits we got ... Read More

716 Views
To create a new column with ratio of two columns based on a condition in an R data frame, we can use division sign with ifelse function.For example, if we have a data frame called df that contains two columns say X and Y and we want to create a new column with ratio of X and Y based on a condition that X is greater than 5 then we can use the below given command −df$Ratio_X_Y5,X/Y,NA))Example 1Following snippet creates a sample data frame −x1