Krantik Chavan has Published 308 Articles

Period parse() method in Java

Krantik Chavan

Krantik Chavan

Updated on 30-Jul-2019 22:30:25

486 Views

The Period instance can be obtained from a string value using the parse() method in the Period class in Java. This method requires a single parameter i.e. the string which is to be parsed. This string cannot be null. Also, it returns the Period instance obtained from the string value ... Read More

C++ Program to Implement Heap Sort

Krantik Chavan

Krantik Chavan

Updated on 30-Jul-2019 22:30:25

629 Views

A Heap is a complete binary tree which is either Min Heap or Max Heap. In a Max Heap, the key at root must be maximum among all keys present in Heap. This property must be recursively true for all nodes in that Binary Tree. Min Heap is similar to ... Read More

Period from() method in Java

Krantik Chavan

Krantik Chavan

Updated on 30-Jul-2019 22:30:25

64 Views

An instance of a Period object can be obtained from a Temporal object using the from() method in the Period class in Java. This method requires a single parameter i.e. the TemporalAmount and it returns the Period object that is obtained.A program that demonstrates this is given as followsExample Live Demoimport ... Read More

C++ Program to Implement Selection Sort

Krantik Chavan

Krantik Chavan

Updated on 30-Jul-2019 22:30:25

19K+ Views

In the selection sort technique, the list is divided into two parts. In one part all elements are sorted and in another part the items are unsorted. At first we take the maximum or minimum data from the array. After getting the data (say minimum) we place it at the ... Read More

Period multipliedBy() method in Java

Krantik Chavan

Krantik Chavan

Updated on 30-Jul-2019 22:30:25

48 Views

An immutable copy of a Period where all the Period elements are multiplied by a value can be obtained using the method multipliedBy() in the Period class in Java. This method requires a single parameter i.e. the value which is to be multiplied and it returns the immutable copy of ... Read More

C++ Program to Check the Connectivity of Directed Graph Using DFS

Krantik Chavan

Krantik Chavan

Updated on 30-Jul-2019 22:30:25

489 Views

To check connectivity of a graph, we will try to traverse all nodes using any traversal algorithm. After completing the traversal, if there is any node, which is not visited, then the graph is not connected.For the directed graph, we will start traversing from all nodes to check connectivity. Sometimes ... Read More

C++ Program to Check Whether a Graph is Strongly Connected or Not

Krantik Chavan

Krantik Chavan

Updated on 30-Jul-2019 22:30:25

302 Views

In directed graph components are said to be strongly connected, when there is a path between each pair of vertices in one component.To solve this algorithm, firstly, DFS algorithm is used to get the finish time of each vertex, now find the finish time of the transposed graph, then the ... Read More

How to GROUP BY in a select query on positive or negative values?

Krantik Chavan

Krantik Chavan

Updated on 30-Jul-2019 22:30:25

425 Views

Following is the syntax to GROUP BY in a select query on positive or negative values:select *from yourTableName group by -yourColumnName;Let us first create a table:mysql> create table DemoTable (Value int); Query OK, 0 rows affected (0.60 sec)Following is the query to insert some records in the table using insert ... Read More

Java Program to create Duration from seconds

Krantik Chavan

Krantik Chavan

Updated on 30-Jul-2019 22:30:25

92 Views

We will get seconds here based on days, hours, millis and minutes, for example, how many seconds in 10 days, seconds in 10 hours, etc.Duration for days, hours, milliseconds and minutes:Duration duration = Duration.ofDays(10); Duration duration1 = Duration.ofHours(10); Duration duration2 = Duration.ofMillis(10); Duration duration3 = Duration.ofMinutes(10);Now, get the seconds:System.out.println("Seconds in ... Read More

Java Program to get the number of minutes in this duration

Krantik Chavan

Krantik Chavan

Updated on 30-Jul-2019 22:30:25

177 Views

At first, set the Duration:Duration duration = Duration.ofHours(10);Now, get the number of minutes from the above Duration that has 10 hours:d1.toMinutes()Exampleimport java.time.Duration; public class Demo {    public static void main(String[] args) {       Duration d1 = Duration.ofDays(25);       Duration d2 = Duration.ofHours(10);       ... Read More

Advertisements