Karthikeya Boyini has Published 2383 Articles

Euler Circuit in a Directed Graph

karthikeya Boyini

karthikeya Boyini

Updated on 16-Jun-2020 11:20:28

2K+ Views

The Euler path is a path, by which we can visit every edge exactly once. We can use the same vertices for multiple times. The Euler Circuit is a special type of Euler path. When the starting vertex of the Euler path is also connected with the ending vertex of ... Read More

What's the simplest way to print a Java array?

karthikeya Boyini

karthikeya Boyini

Updated on 16-Jun-2020 11:16:55

99 Views

Generally, to print the contents of an array you need to use for loops, in addition to that you can directly print an array using the toString() method of this class. This method accepts an array as a parameter and returns it in String format.ExampleLive Demoimport java.util.Arrays; public class ... Read More

Tug of War Algorithm

karthikeya Boyini

karthikeya Boyini

Updated on 16-Jun-2020 09:44:58

720 Views

In this problem a set of integers are given, we have to break them into two parts, such that the difference of the sum of two subsets is minimum as possible. So our target is to divide two groups of nearly equal strength to participate in the Tug of war ... Read More

Max Number By Swapping

karthikeya Boyini

karthikeya Boyini

Updated on 16-Jun-2020 09:39:27

473 Views

In this problem, one positive integer string is given, we have to find the permutation whose value is maximum by swapping digits’ k times, into different places.We will solve this problem by choosing a digit and swap it with digits following it one at a time to find a maximum ... Read More

Peak Element in 2D array

karthikeya Boyini

karthikeya Boyini

Updated on 16-Jun-2020 09:33:16

865 Views

An item is said to be a peak element when it is greater than or equal with all four neighbor of that element. The neighbor elements are the top, bottom, left and right elements. For this problem, we will consider some bounds. The diagonal elements are not checked as neighbor ... Read More

Median of two sorted array

karthikeya Boyini

karthikeya Boyini

Updated on 16-Jun-2020 09:23:44

489 Views

Medians are the middle numbers, in other words, the median value is the middle observation in an ordered list. It corresponds to the cumulative percentage of 50%.The size of two arrays must be same, we will find the median of two separate arrays at first, then compare the separate medians ... Read More

How to move an array element from one array position to another in Java?

karthikeya Boyini

karthikeya Boyini

Updated on 16-Jun-2020 08:43:04

12K+ Views

To move an element from one position to other (swap) you need to –Create a temp variable and assign the value of the original position to it.Now, assign the value in the new position to original position.Finally, assign the value in the temp to the new position.ExampleLive Demoimport java.util.Arrays; ... Read More

M-Coloring Problem

karthikeya Boyini

karthikeya Boyini

Updated on 16-Jun-2020 07:58:12

8K+ Views

In this problem, an undirected graph is given. There is also provided m colors. The problem is to find if it is possible to assign nodes with m different colors, such that no two adjacent vertices of the graph are of the same colors. If the solution exists, then display ... Read More

Rat in a Maze Problem

karthikeya Boyini

karthikeya Boyini

Updated on 16-Jun-2020 07:23:16

5K+ Views

In this problem, there is a given maze of size N x N. The source and the destination location is top-left cell and bottom right cell respectively. Some cells are valid to move and some cells are blocked. If one rat starts moving from start vertex to destination vertex, we ... Read More

Subset Sum Problem

karthikeya Boyini

karthikeya Boyini

Updated on 16-Jun-2020 07:09:28

15K+ Views

In this problem, there is a given set with some integer elements. And another some value is also provided, we have to find a subset of the given set whose sum is the same as the given sum value.Here backtracking approach is used for trying to select a valid subset ... Read More

Advertisements