Nishtha Thakur has Published 564 Articles

C++ Program to Implement Stack Using Two Queues

Nishtha Thakur

Nishtha Thakur

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

982 Views

StackThe stack which is implemented as LIFO, where insertion and deletion are done from the same end, top. The last element that entered is deleted first.Stack operations are −push (int data) − Insertion at topint pop() − Deletion from topQueueThe queue which is implemented as FIFO where insertions are done at ... Read More

How to select distinct value from one MySQL column only?

Nishtha Thakur

Nishtha Thakur

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

1K+ Views

To select distinct value from one column only, you can use aggregate function MAX() along with GROUP BY. Let us first create a table −mysql> create table distinctFromOneColumn    -> (    -> StudentId int,    -> StudentName varchar(100)    -> ); Query OK, 0 rows affected (0.77 sec)Following is ... Read More

C++ Program to Implement Queue

Nishtha Thakur

Nishtha Thakur

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

3K+ Views

QueueThe queue which is implemented as FIFO where insertions are done at one end (rear) and deletions are done from another end (front). The first element that entered is deleted first.Queue operations are −EnQueue (int data) − Insertion at rear endint DeQueue()− Deletion from front endThis is a C++ program ... Read More

How to compare timestamps in MySQL?

Nishtha Thakur

Nishtha Thakur

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

3K+ Views

To compare timestamps in MySQL, you can use DATE(). Let us first create a table−mysql> create table comparingTimestampDemo    -> (    -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> AdmissionDate timestamp    -> ); Query OK, 0 rows affected (0.54 sec)Following is the query to insert records ... Read More

Order of evaluation in C++ function parameters

Nishtha Thakur

Nishtha Thakur

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

139 Views

We pass different arguments into some functions. Now one questions may come in our mind, that what the order of evaluation of the function parameters. Is it left to right or right to left?To check the evaluation order we will use a simple program. Here some parameters are passing. From ... Read More

C++ Program to Implement Nearest Neighbour Algorithm

Nishtha Thakur

Nishtha Thakur

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

2K+ Views

This is a C++ program to implement Nearest Neighbour Algorithm which is used to implement traveling salesman problem to compute the minimum cost required to visit all the nodes by traversing across the edges only once.Required functions and pseudocodesAlgorithmBegin    Initialize c = 0, cost = 1000;    Initialize g[][]. ... Read More

Add10 minutes to MySQL datetime format?

Nishtha Thakur

Nishtha Thakur

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

302 Views

Use DATE_ADD() to add 10 minutes to datetime format. Following is the syntax −select date_add(yourColumnName ,interval 10 minute) from yourTableName;Let us first create a table −mysql> create table add10MinuteDemo    -> (    -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> DelayDatetime datetime    -> ); Query OK, ... Read More

How to convert string to char array in C++?

Nishtha Thakur

Nishtha Thakur

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

1K+ Views

This is a C++ program to convert string to char array in C++. This can be done in multiple different waysType1AlgorithmBegin    Assign a string value to a char array variable m.    Define and string variable str    For i = 0 to sizeof(m)       Copy character ... Read More

Checking if a double (or float) is NaN in C++

Nishtha Thakur

Nishtha Thakur

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

12K+ Views

To check whether a floating point or double number is NaN (Not a Number) in C++, we can use the isnan() function. The isnan() function is present into the cmath library. This function is introduced in C++ version 11. So From C++11 next, we can use this function.Example#include #include ... Read More

Differences between pass by value and pass by reference in C++

Nishtha Thakur

Nishtha Thakur

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

17K+ Views

In C++ we can pass arguments into a function in different ways. These different ways are −Call by ValueCall by ReferenceCall by AddressSometimes the call by address is referred to as call by reference, but they are different in C++. In call by address, we use pointer variables to send ... Read More

Advertisements