Found 27104 Articles for Server Side Programming

Implementing PCA in Python with scikit-learn

Someswar Pal
Updated on 05-Oct-2023 15:57:13

246 Views

Introduction Extraction of useful information from high-dimensional datasets is made easier by Principal component analysis, (PCA) a popular dimensionality reduction method. It does this by re-projecting data onto a different axis, where the highest variance can be captured. The complexity of the dataset is reduced while its basic structure is preserved by PCA. It helps with things like feature selection, data compression, and noise reduction in data analysis, and it can even reduce the dimensionality of the data being analyzed. Image processing, bioinformatics, economics, and the social sciences are just a few of the places PCA has been put to use. ... Read More

Maximum count of unique index 10 or 01 substrings in given Binary string

Shubham Vora
Updated on 05-Oct-2023 13:00:47

73 Views

In this problem, we will count the maximum number of 10 and 01 pairs that can be formed using the given binary string. To solve the problem, we can check the number of 10 and 01 pairs we can form using adjacent characters without sharing any characters in two pairs. Problem Statement We have given a bin_str binary string. We need to count the maximum number of 10 and 01 pairs we can make using the adjacent characters only. Also, we can use one character in any single pair. Two pairs can't share a single character. Sample Examples Input ... Read More

Find index of pair among given pairs with just greater average

Shubham Vora
Updated on 05-Oct-2023 12:55:38

55 Views

In this problem, we will find the index value for each pair such that the resultant pair's average value is just greater than the current pair's average value. To solve the problem, we will use the sorting algorithm and binary search technique. We will use a sorting algorithm to sort the array based on the pair's average value and a binary search algorithm to search a pair with a greater average value from the sorted array. Problem Statement We have given a pairs[] array containing the N pairs of positive integers. It is also given that the first element of ... Read More

Count unique Strings by replacing Consonant with closest vowel and vice versa

Shubham Vora
Updated on 05-Oct-2023 12:51:25

51 Views

In this problem, we will count the number of unique strings we can generate by replacing each vowel with the closest consonant and each consonant with the closest vowel. We can find the number of choices for each character of the string to replace the current character with other characters. After that, we can multiply the number of choices of each character to get the answer. Problem Statement We have given an alpha string. We need to count the total number of different strings we can generate from the given string by performing the below operations on each character of ... Read More

Can String be considered as a Keyword?

Shubham Vora
Updated on 05-Oct-2023 12:50:26

101 Views

Keywords are important in any programming language, as they are reserved words with a particular predefined meaning. The keywords are used to define the variables, function, and class, change the program's control flow, traverse the list, etc. When we talk about the 'String', it is a fundamental data type to represent a series of characters. Some programming languages refer to the 'String' as a class, and some programming languages refer to the 'String' as a keyword. In this tutorial, we will explore the use of the 'String' word in the programming language. C/C++ The C or C++ programming languages are ... Read More

C++ Program to Find the Mth element of the Array after K left rotations

Shubham Vora
Updated on 05-Oct-2023 12:58:55

45 Views

In this problem, we need to print the element from the given index after rotating the array for K times. This problem teaches us to find the element from the particular index in the rotational array. At first sight, the solution that comes to mind is that rotate the array for K times and access the Mth element, but we will also learn to access the Mth element in the rotational array without rotating the array. Problem Statement We have given arr[] array containing N numbers. Also, we have given the positive integer M and K. We need to rotate ... Read More

Value of k-th index of a series formed by append and insert MEX in middle

Vaishnavi Tripathi
Updated on 05-Oct-2023 11:58:31

40 Views

In this article, we will learn about Mex and will also generate the C++ code that returns the kth index of the series so formed by using append and MEX (>0) operations on the given sequence. The roadmap of the operations to be performed is given below − Start with a sequence containing only the number 1 i.e, [1]. Now, we need to perform (n-1) steps − In each step, we append the current series by itself. For example, if the existing series is [1, 2, 3], after appending, it becomes [1, 2, 3, 1, 2, 3]. Now, find ... Read More

Sum of series (n/1) + (n/2) + (n/3) + (n/4) +……. + (n/n)

Vaishnavi Tripathi
Updated on 05-Oct-2023 11:57:51

137 Views

This this article, we will discuss the different approaches to calculate the sum of the given series. Problem Statement We are given a number and our task is to calculate the sum of the series Σ (n / i) for I =0 to i=n. We are given any given value of n where n can be any number less than 10^12 considering on integer division. For example, if the given input is 10, The sum of given series can be written as (10/1) + (10/2) + (10/3) + (10/4) + (10/5) + (10/6) + (10/7) + (10/8) + ... Read More

Stable sort for descending order

Vaishnavi Tripathi
Updated on 05-Oct-2023 11:55:41

132 Views

In this article, we will discuss what is meant by stable sorting and how can we sort an array in descending order keeping in mind that the sorting algorithm should be stable. Let us first discuss about what are the features of a stable sort algorithm − A sorting algorithm is called stable if it keeps the original order of items with the same value in the input data when they are sorted. So, if there are two or more items with the same value, a stable sorting algorithm will not change their relative positions in the sorted output. Stable ... Read More

Ropes left after every removal of smallest rope

Vaishnavi Tripathi
Updated on 05-Oct-2023 11:49:33

66 Views

In this article, we will discuss two approaches to solve the problem - Ropes left after every removal of smallest rope. Problem Statement We are given an array of elements where array [i] denotes the length of the ith rope in the array. Our task is to cut a length equal to the smallest element of the array from all the elements of the array until we have all the elements length equal to zero. We have to output the number of ropes with non-zero lengths after each cut operation. Let us consider an example for the same − Let ... Read More

Advertisements