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
 
Server Side Programming Articles - Page 769 of 2650
 
			
			4K+ Views
To change the decimal point of every value in an R data frame column, we can use round function.For Example, if we have a data frame called df that contains a column say X and we want to have each value with 3 decimal places then we can use the below command −df$X
 
			
			99 Views
When we find the mean of normal random variable which is created with rnorm(“sample_size”, 10) is not 10 because rnorm will create a random variable hence mean will be changed but as we increase the sample size the mean will become closer to 10.Check out the Examples given below to understand the variation in the Outputs as the sample size increases.ExampleThe variation in the Outputs of mean of normal random variable created by using rnorm as the sample size increases is explained below −mean(rnorm(100, mean=10)) mean(rnorm(100, mean=10)) mean(rnorm(100, mean=10)) mean(rnorm(100, mean=10)) mean(rnorm(100, mean=10)) mean(rnorm(100, mean=10)) mean(rnorm(100, mean=10)) mean(rnorm(1000, mean=10)) mean(rnorm(1000, ... Read More
 
			
			354 Views
We are given two integer arrays, one having the elements which are computed and other having split points which are required to split the array for making subset and we have to calculate the sum of each subset in every split and return the maximum subset sum.Let us understand with example:-Input − int arr[] = int arr[] = { 9, 4, 5, 6, 7 } int splitPoints[] = { 0, 2, 3, 1 };Output − Maximum subarray sum after each split [22, 13, 9, 9]Explanation − Here we are breaking the array according to their split points and obtaining the maximum subset sum ... Read More
 
			
			395 Views
We are provided with an array and a sum value; the problem statement is to calculate the maximum subset sum which does not exceed the given sum value. We cannot apply the brute force approach here because the structure of the given array is not the same as the divide and conquer approach.Let us see various input output scenarios for this -Let us understand with exampleInput − long arr[] = { 21, 1, 2, 45, 9, 8 } long given_Sum = 12Output −The maximum sum subset having sum less than or equal to the given sum-->12Explanation −The array is split into a set ... Read More
 
			
			374 Views
We are given 5 Integer variables Num, P1, P2, profit_P1, profit_P2 and the task is to maximize the profit and from all the natural numbers in the range of [1, Num]. The approach here is that if a positive number is divisible by P1 the profit increases by profit_P1 and similarly if if the number in the range is divisible by P2 the profit margin of profit_P2 increases. Also, the profit from a positive integer can be added at most once.Let us understand with example:-Input − int num = 4, P1 = 6, P2 = 2, profit_P1 = 8, profit_P2 = ... Read More
 
			
			797 Views
We are given a K number of linked lists of variable sizes which are sorted in their sequence and we have to merge the list into a resultant list in such a way that the resultant array is sorted in order and the resultant array is printed as the output to the user.Let us understand with example:-Input −int k = 3;list[0] = new Node(11);list[0].next = new Node(15);list[0].next.next = new Node(17);list[1] = new Node(2);list[1].next = new Node(3);list[1].next.next = new Node(26);list[1].next.next.next = new Node(39);list[2] = new Node(4);list[2].next = new Node(8);list[2].next.next = new Node(10);Output −The merged list is-->2>> 3>> 4>> 8>> 10>> 11>> 15>> 17>> ... Read More
 
			
			275 Views
The problem statement here is to kill the goons in the rooms of a building with minimum number of bombings. The rooms are labelled as 1 to n. The goons are injured by the first bombing attack and die in the second. When the rooms are bombed the goons rush to the nearest room in the building specially the neighboring room. We must calculate the number of bombing it is required to bomb the rooms in order to kill all the goons in the building.Let us understand with exampleInput − int number of rooms = 3Output −Total Bombings required42 1 3 2Explanation − ... Read More
 
			
			743 Views
We are given an ‘n’ number of arrays, let's say we take three arrays i.e. arr1[], arr2[] and arr3[] of integer type. The task is to merge all the given integer arrays in such a manner that the resultant array is sorted in the runtime only.Let us understand with exampleInput −Inta[]={21, 22, 23, 24};int b[ ] ={28, 31, 35}Output −int resultant[ ]={21, 22, 23, 24, 28, 31, 35}.Explanation − The array elements are compared before they are added and added according to their suitable position in the resultant array.Input −inta[]={1, 3, 5, 7, 9, 11, 13};int b[ ] ={14, 16, 18}int c[ ] ={19, ... Read More
 
			
			1K+ Views
To find the missing numbers in a sequence in R data frame column, we can use setdiff function.For Example, if we have a data frame called df that contains a column say X and we want to check which values between 1 to 20 are missing in this column then we can use the below command −setdiff(1:20,df$X)Example 1Following snippet creates a sample data frame −x
 
			
			149 Views
To extract columns from an R data frame having at least one non-duplicate, we can use Filter function.For Example, if we have a data frame called df that contains some columns having duplicate values and columns that do not contains at least one non-duplicate then we can extract columns having at least one non-duplicate by using the below command −Filter(var,df)Example 1Following snippet creates a sample data frame −x1