Consider we have a binary tree, this binary tree is not a BST. We have to check whether the binary tree contains same element more than one time or not. To solve this, we will use hashing. We will traverse the given tree, for each node, we will check whether the node is present in the table or not, if that is already present, then return false, otherwise true.Example Live Demo#include #include using namespace std; class Node { public: int data; Node *left; Node *right; }; Node* getNode(int data){ Node *newNode = new Node; ... Read More
Suppose we have a binary string, another integer k. We have to check the string is containing all permutations of binary of k bits. Suppose a string is like “11001”, and if the K = 2, then it must have all permutations of k bit numbers. (00, 01, 10, 11), the given string has all permutation. So this is valid string.by taking the binary string and the value of k, we have to check whether binary sequences are matched or not. The binary sequence is made of size k. So there will be 2k number of different binary permutations. We ... Read More
Nowadays, we all know that one of the most panicking moments of our life is when we have lost our smartphone. We tend to miss it during our daily commute or misplace it in any public spots. It’s now time to thank our technology growth which gives us the ray of hope to find our missing phones back. There are a few ways to remote control and track your phone even if you haven’t installed a recovery app before it vanishes.Do not wait until you’ve lost your smartphone and then to wonder how to track it. This article will help ... Read More
Refurbished Samsung Galaxy Note 7Seems like the world hasn’t had enough of the Galaxy Note 7, they just might sell out refurbished units of the Note 7 with smaller batteries minus the chance of explosions happening anymore. To avoid garbage and environmental damage, Samsung Galaxy has decided to revamp their design and use the older scraps and units of the smartphones and make sales post minor yet necessary changes.Moto G5 and G5 PlusThe awaited Moto G5 models coming out with a few similar specifications, Android 7.0 Nougat, full-HD screen resolution, Corning Gorilla Glass 3 cover, 128GB expandable storage, fingerprint scanner, ... Read More
For many years, companies have been using computers to send business documents instead of mailing paper documents. But the problem arises when Company A won’t recognize e-format of Company B due to the absence of a standard format which led to the condition where computers could no longer “talk” to one another and again a great deal of effort by programmers need to put which led the cost.In 1979 the American National Standards Institute (ANSI) formed the Accredited Standards Committee (ASC) X12 to rectify this situation. This committee was to standardize the format of electronic documents to allow for easy ... Read More
Suppose we have one 2D array of size N x M. The task is to check if we can select a number from every row, in such a way that the XOR of those elements is non-zero or greater than 0. Suppose one matrix is like this −77710107If we perform XOR, the answer will be non-zero, as the except last elements of two rows are 7 and 10To solve this problem, the solution will be very easy. Initially check if XOR of the elements of the first column of each row is 0 or not. If it is non-zero then ... Read More
The bold move made by Apple to remove the traditional 3.5 mm headphone jack from the iPhone 7 has created quite a hustle, all over the internet and the social media. This is Apple’s take on moving ahead towards the future. Since the announcement of the decision, the company has been subjected to comic criticism, sarcastic mockery, and millions of jokes.Disappointment from UsersIn fact, this decision has disappointed a great number of Apple fans. Now iPhone users cannot connect their older headphones directly with their iPhones. Although, Apple provides a Lightning to 3.5 mm converter within the sales package of ... Read More
Suppose we have a circle and another straight line. Our task is to find if the line touches the circle or intersects it, otherwise, it passes through outside. So there are three different cases like below −Here we will solve it by following steps. These are like below −Find perpendicular P between the center and given a lineCompare P with radius r −if P > r, then outsideif P = r, then touchesotherwise insideTo get the perpendicular distance, we have to use this formula (a center point is (h, k))$$\frac{ah+bk+c}{\sqrt{a^2+b^2}}$$Example Live Demo#include #include using namespace std; void isTouchOrIntersect(int a, ... Read More
New era Smart watches are computerized wristwatches whose functionality can go ahead of mere timekeeping. The utility of smart watches are no more limited to just showing the time, rather the recent ones can be handy for tasks such as elementary calculations, manage phone calls, listening music and much more.Nowadays, with the advent of a higher version of operating system, the basic purpose of smart watches has taken a paradigm shift. As it can run media players and can play digital audio and video files. It can also assist Bluetooth or USB headset. In fact, the recent watches can be ... Read More
Here we will see how to check whether a tree graph is linear or not. A linear tree graph can be expressed in one line, suppose this is an example of a linear tree graph.But this is not linear −To check a graph is linear or not, we can follow two conditionsIf the number of nodes is 1, then the tree graph is linearIf (n – 2) of its nodes have in-degree 2Example Live Demo#include #include #define N 4 using namespace std; class Graph{ private: int V; vector *adj; public: Graph(int v){ ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP