Found 33676 Articles for Programming

Length of Smallest Substring to be Replaced to make Frequency of each Character as N/3

Shubham Vora
Updated on 25-Aug-2023 15:38:41

155 Views

In this problem, we need to find the smallest substring so that we can replace its character and make the frequency of each character equal to the N/3 in the given string. We can use the sliding window technique to solve the problem. We can find the minimum window size, which contains all excess characters, that will be the answer to the problem. Problem statement – We have given a string alpha. The size of the alpha is N which is always divisible by 3. The given task is to find the minimum length of the substring so that we ... Read More

Javascript Program to Minimize Characters to be Changed to make the Left and Right Rotation of a String Same

Shubham Vora
Updated on 25-Aug-2023 15:31:37

118 Views

In this problem, we require to determine the minimal cost to make the string’s left and right rotation same. Here is the observation which we will use to solve the problem. All characters should be equal for strings with odd lengths to make the left and right rotations the same. The string with an even length should have characters same at the even and odd indexes. Problem statement – We have a string of size N containing the different characters. We need to determine the minimum cost to make the left and right rotations of the given ... Read More

Java Program to Minimize Characters to be changed to make the Left and Right Rotation of a String Same

Shubham Vora
Updated on 25-Aug-2023 15:24:18

140 Views

In this problem, we need to change the minimum characters in the given string to make its left and right rotations the same. In the string, we can observe that we can only make the left and right rotations of the string same if the string has an odd length and all characters are same, or the string has an even length and characters at even and odd indexes the same. For example, abab – Left and right rotation of the string is baba and baba. aaa – Left and right rotation of the stirng is aaa and aaa. ... Read More

Non-Linear SVM in Machine Learning

Mithilesh Pradhan
Updated on 27-Aug-2023 13:01:41

3K+ Views

Introduction Support Vector Machine (SVM) is one of the most popular supervised Machine Learning algorithms for classification as well as regression. The SVM Algorithm strives to find a line of best fit between n−dimensional data to separate them into classes. a new data point can thus be classified into one of these classes. The SVM algorithm creates two hyperplanes while maximizing the margin between them. The points that lie on these hyperplanes are known as Support Vectors and hence the name Support Vector Machine. The below diagram shows the decision boundary and hyperplanes for an SVM that is used to ... Read More

Java Program to Find Maximum number of 0s placed consecutively at the start and end in any rotation of a Binary String

Shubham Vora
Updated on 25-Aug-2023 15:22:27

222 Views

In this problem, we will write Java code to find the maximum sum of consecutive zeros at the start and end of any string rotation. First, we will use a naïve approach to solve the problem, which generates all rotations of the binary string and counts the starting and ending consecutive zeros. After that, we will learn an optimized algorithm that counts the maximum consecutive zeros. Problem statement – Here, we have a string of size N containing only 0 and 1 characters. We need to find the maximum sum of consecutive zeros at the start and end of any ... Read More

Mini Batch K-means clustering algorithm in Machine Learning

Mithilesh Pradhan
Updated on 27-Aug-2023 12:59:35

1K+ Views

Introduction Clustering is a technique to group data points into various subgroups such that each point within each subgroup are similar. It is an unsupervised algorithm and there are no labels or ground truth. Mini batch K Means is a variant of the K−Means algorithm that trains from batches at random from memory. In this article let us understand Mini Batch K−Means in detail. Before moving on to Mini Batch K−Means let us have a look at K−Means in general The K−Means clustering approach The K−Means is an iterative approach that tries to group data points into K separate subgroups ... Read More

Java Program to Implement Unrolled Linked List

Shubham Vora
Updated on 24-Aug-2023 18:10:04

221 Views

In this problem, we will learn to implement the unrolled linked list. The unrolled linked list is a specialized version of the linked list. The normal linked list contains a single element in a single node, but the unrolled linked list contains a group of elements in each node. Also, insertion, deletion, and traversal in the unrolled linked list work the same as the typical linked list. The linear search is faster in the array than in the linked list. So, we can add elements in the array and an array in each node of the linked list. Also, ... Read More

Java Program to Implement the Vizing's Theorem

Shubham Vora
Updated on 24-Aug-2023 18:07:17

138 Views

In this problem, we need to implement Vizing's Theorem. Vizing's Theorem is used with graphs. Theorem statement - For any undirected graph G, the value of the Chromatic index is equal to the d or d + 1, where d is the maximum degree of the graph. The degree for any vertex is the total number of incoming or outgoing edges. Problem statement - We have given a graph and need to implement Vizing's Theorem to find the Chromatic index of the graph. Note - The chromatic index is a positive integer, requiring a ... Read More

Java Program to Implement the Schonhage-Strassen Algorithm for Multiplication of Two Numbers

Shubham Vora
Updated on 24-Aug-2023 18:04:22

259 Views

The Schonhage-Strassen algorithm is useful when we need to multiply large decimal numbers. As Java supports the 1018 size of integers, and if we need to multiply the digits of more than 1018, we need to use the Schonhage-Strassen algorithm, as it is one of the fastest multiplication algorithms. It uses the basic rules for the multiplication of two numbers. It first performs the linear convolution and then performs the carry to get the final result. Problem statement - We have given mul1 and mul2 large decimal numbers and need to implement the Schonhage-Strassen algorithm to multiply both ... Read More

Java Program to Implement the RSA Algorithm

Shubham Vora
Updated on 31-May-2024 15:28:42

6K+ Views

The RSA name is given by their inventors which is used to encrypt the text with high security. The RSA technique is one of the most used techniques to encrypt text, as it is the asymmetric encryption algorithm. It encrypts the text by utilizing the mathematical properties of the prime numbers. In the RSA algorithm, the sender and receiver have private keys. Also, a common public key exists, which the sender shares with the receiver. The sender encrypts the plain text using their own public and private key, and the receiver decrypts the message using their private and public ... Read More

Advertisements