George John has Published 1167 Articles

C++ Program to Implement Min Heap

George John

George John

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

10K+ Views

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

How can I to know if my database MongoDB is 64 bits?

George John

George John

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

96 Views

You can use buidInfo along with runCommand to check MongoDB for 32 bits or 64 bits. First switch your database to admin. Following is the syntaxuse adminAfter that use the following syntax to know if my server runs MongoDB 64 bits or notdb.runCommand(buildInfo)Now execute the above syntax> use admin switched ... Read More

Count two different columns in a single query in MySQL?

George John

George John

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

5K+ Views

You can use CASE statement to count two different columns in a single query. To understand the concept, let us first create a table. The query to create a table is as follows.mysql> create table CountDifferentDemo    - > (    - > ProductId int NOT NULL AUTO_INCREMENT PRIMARY KEY, ... Read More

LongStream empty() method in Java

George John

George John

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

81 Views

The empty() method of the LongStream class in Java returns an empty sequential LongStream.The syntax is as follows.static LongStream empty()To use the LongStream class in Java, import the following package.import java.util.stream.LongStream;The following is an example to implement LongStream empty() method in Java.Example Live Demoimport java.util.stream.LongStream; public class GFG {    public ... Read More

Is it possible to rename _id field after MongoDB group aggregation?

George John

George John

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

2K+ Views

Yes, it is possible to rename using aggregation. Let us first create a collection with documents> db.renameIdDemo.insertOne({"StudentName":"Chris"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9a1760353decbc2fc927c5") } > db.renameIdDemo.insertOne({"StudentName":"Robert"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9a1765353decbc2fc927c6") } > db.renameIdDemo.insertOne({"StudentName":"David"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9a176b353decbc2fc927c7") ... Read More

Which version is my MySQL?

George John

George John

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

107 Views

You can use two approaches to know the version of MySQL. In the first approach, you can use version() to know the MySQL Server version. The first approach is as followsSELECT VERSION();In the second approach, you can use SHOW VARIABLES command to know the MySQL version. The second approach is ... Read More

Sorting in C++

George John

George John

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

1K+ Views

In this section we will see how to perform sorting algorithm in C++. A sorted array is an array in which each of the elements are sorted in some order such as numerical, alphabetical etc. There are many algorithms to sort a numerical array such as bubble sort, insertion sort, ... Read More

The toArray(T[] a) T method of Java AbstractCollection class

George John

George John

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

81 Views

The difference between toArray() and toArray(T[] arr) in Java AbstractCollection is that both the methods returns an array containing all of the elements in this collection, but the latter has some additional features i.e. the runtime type of the returned array is that of the specified array.The syntax is as ... Read More

Increment MongoDB value inside a nested array

George John

George John

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

115 Views

To increment a value inside a nested array, use positional operator ($). Let us first create a collection with documents> db.incrementInNestedArrayDemo.insertOne( ... { ...    "StudentId":100, ...    "ProjectDetails": ...    [ ...       {"ProjectId":567778888, ...          "TeamSize":4 ...       }, ...   ... Read More

Zombie and Orphan Processes in Linux

George John

George John

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

6K+ Views

Details about the zombie, orphan and daemon processes are given as followsZombie ProcessesA zombie process is a process whose execution is completed but it still has an entry in the process table. Zombie processes usually occur for child processes, as the parent process still needs to read its child’s exit ... Read More

Advertisements