Samual Sam has Published 2310 Articles

LocalTime toSecondOfDay() method in Java

Samual Sam

Samual Sam

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

85 Views

The time in the form of seconds of the day can be obtained using the toSecondOfDay() method in the LocalTime class in Java. This method requires no parameters and it returns the time in the form of seconds of the day.A program that demonstrates this is given as follows −Example Live ... Read More

C++ Program to Implement Hash Tables Chaining with List Heads

Samual Sam

Samual Sam

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

631 Views

A hash table is a data structure which is used to store key-value pairs. Hash function is used by hash table to compute an index into an array in which an element will be inserted or searched.This is a C++ Program to Implement Hash Tables Chaining with List Heads.AlgorithmFor insert:Begin ... Read More

Java Program to convert positive int to negative and negative to positive

Samual Sam

Samual Sam

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

9K+ Views

To convert positive int to negative and vice-versa, use the Bitwise Complement Operator.Let us first initialize a positive int −int positiveVal = 200;Now, let us convert it to negative −int negativeVal = (~(positiveVal - 1));Now, let’s say we have the following negative int −int negativeVal = -300;The following will convert ... Read More

How to sort time in AM/ PM in MySQL?

Samual Sam

Samual Sam

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

2K+ Views

To sort time in AM/PM in MySQL, you can use ORDER BY STR_TO_DATE(). Following is the syntax −select yourColumnName from yourTableName ORDER BY STR_TO_DATE(yourColumnName , '%l:%i %p');Let us first create a table −mysql> create table DemoTable (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    UserLogoutTime varchar(200) ); Query OK, ... Read More

How to know the exact number of table and columns in a MySQL database?

Samual Sam

Samual Sam

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

269 Views

To get the exact number if table and columns in a MySQL database, use the DISTINCT inside COUNT().Let’s say we have a database ‘sample’ and we need to work on it to get the exact number of table and columns.To achieve it, the query is as follows −mysql> SELECT COUNT(DISTINCT ... Read More

LocalTime plusMinutes() method in Java

Samual Sam

Samual Sam

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

78 Views

An immutable copy of a LocalTime object where some minutes are added to it can be obtained using the plusMinutes() method in the LocalTime class in Java. This method requires a single parameter i.e. the number of minutes to be added and it returns the LocalTime object with the added ... Read More

C++ Program to Implement Hash Tables with Double Hashing

Samual Sam

Samual Sam

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

3K+ Views

A hash table is a data structure which is used to store key-value pairs. Hash function is used by hash table to compute an index into an array in which an element will be inserted or searched.Double hashing is a collision resolving technique in Open Addressed Hash tables. Double hashing ... Read More

Java Program to remove key value pair from HashMap?

Samual Sam

Samual Sam

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

300 Views

Let’s say the following is our HashMap −HashMapmap = new HashMap();Add key value pair to the HashMap −map.put("1", "A"); map.put("2", "B"); map.put("3", "C"); map.put("4", "D"); map.put("5", "E"); map.put("6", "F"); map.put("7", "G"); map.put("8", "H"); map.put("9", "I");Now, use the remove() method to remove the key-value pair −map.remove("5");Example Live Demoimport java.util.Collection; import java.util.HashMap; import ... Read More

How to check if data is NULL in MySQL?

Samual Sam

Samual Sam

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

427 Views

You can use IF() to check if data is NULL.  Let us first create a table −mysql> create table DemoTable (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    Name varchar(200),    Age int ); Query OK, 0 rows affected (0.44 sec)Insert records in the table using insert command −mysql> ... Read More

C++ Program to Implement Hash Tables with Linear Probing

Samual Sam

Samual Sam

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

10K+ Views

A hash table is a data structure which is used to store key-value pairs. Hash function is used by hash table to compute an index into an array in which an element will be inserted or searched.Linear probing is a collision resolving technique in Open Addressed Hash tables. In this ... Read More

Advertisements