Articles on Trending Technologies

Technical articles with clear explanations and examples

How to find the missing number and the repeated number in a sorted array without using any inbuilt functions using C#?

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

To find the missing numberCreate a new array and traverse through the entire array and make the number true in the new array if the number is found Traverse through the entire array and return the first false element as the missing element.To find the repeating elementThe first true element from the new array will be the repeated element.Exampleusing System; namespace ConsoleApplication{    public class Arrays{       public void MissingNumberAndRepeatedNumber(int[] arr){          bool[] tempArray = new bool[arr.Length + 1];          int missingelement = -1;          int repeatingelement = -1; ...

Read More

Python – Dual Tuple Alternate summation

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 218 Views

When it is required to perform dual tuple alternate summation, a simple iteration and the modulus operator are used.Below is a demonstration of the same −Examplemy_list = [(24, 11), (45, 66), (53, 52), (77, 51), (31, 10)] print("The list is :") print(my_list) my_result = 0 for index in range(len(my_list)):    if index % 2 == 0:       my_result += my_list[index][0]    else:       my_result += my_list[index][1] print("The result is :") print(my_result)OutputThe list is : [(24, 11), (45, 66), (53, 52), (77, 51), (31, 10)] The result is : 225ExplanationA list of tuple ...

Read More

How to create a line chart using ggplot2 that touches the edge in R?

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

To create a line chart using ggplot2 that touches the edge we can follow the below steps −First of all, creating data frame.Then loading ggplot2 package and creating the line chart in default manner.After that creating the line chart with coord_cartesian function.Create the data frameLet's create a data frame as shown below −x

Read More

How to find the groupwise correlation matrix for an R data frame?

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

To create groupwise correlation matrix for an R data frame, we can follow the below steps −First of all, create a data frame.Then, find the correlation matrix by splitting the data frame based on categorical column.Create the data frameLet's create a data frame as shown below −v1

Read More

How to find the minimum number of jumps required to reach the end of the array using C#?

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

We can simply start from the first element and repeatedly call for all the elements reachable from first element. The minimum number of jumps to reach end from first can be calculated using minimum number of jumps needed to reach end from the elements reachable from first.Array == {1, 3, 6, 3, 2, 3, 6, 8, 9, 5};Number of steps required is 4Exampleusing System; namespace ConsoleApplication{    public class Arrays{       public int MinJumps(int[] arr, int l, int h){          if (h == l)             return 0;          if (arr[l] == 0)             return int.MaxValue;          int min = int.MaxValue;          for (int i = l + 1; i

Read More

Python Program to extracts elements from a list with digits in increasing order

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 199 Views

When it is required to extracts elements from a list with digits in increasing order, a simple iteration, a flag value and the ‘str’ method is used.Below is a demonstration of the same −Examplemy_list = [4578, 7327, 113, 3467, 1858] print("The list is :") print(my_list) my_result = [] for element in my_list:    my_flag = True    for index in range(len(str(element)) - 1):       if str(element)[index + 1]

Read More

How to convert a variable into zero mean and unit variance in an R data frame?

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

Converting a variable into zero mean and unit variance means that we want to standardize the variable and it can be done with the help of scale function we can follow the below steps −First of all, creating data frame.Then using scale function to convert the variable into zero mean and unit variance.Create the data frameLet's create a data frame as shown below −x

Read More

How to subset an R data frame with condition based on only one value from categorical column?

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

To subset an R data frame with condition based on only one value from categorical column, we can follow the below steps −First of all, create a data frame.Then, subset the data frame with condition using filter function of dplyr package.Create the data frameLet's create a data frame as shown below −Class

Read More

How to rotate a matrix of size n*n to 90-degree k times using C#?

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

The entire matrix needs to be rotated k number of times. In a matrix there is a total of n/2 squares in n*n matrix and we can process each square one at a time using nested loop. In each square, elements are moving in a cycle of 4 elements then we swap the elements involved in an anticlockwise direction for each cycle.Element at position (n-1-j, i) will go to position(i, j)Element at position (i, j) will go to position(j, n-1-i)Element at position (j, n-1-i) will go to position(n-1-i, n-1-j)Element at position (n-1-i, n-1-j) will go to position(n-1-j, i)Exampleusing System; using ...

Read More

How to display categorical column name in facet grid in R?

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

To display categorical column name in facet grid, we can use the following steps −First of all, creating data frame.Loading ggplot2 package and creating a chart with facetsCreating the chart with facets and labeller function to display categorical column nameCreate the data frameLet's create a data frame as shown below −x

Read More
Showing 541–550 of 61,248 articles
« Prev 1 53 54 55 56 57 6125 Next »
Advertisements