Check for Duplicate Elements Within K Distance in C++

Arnab Chakraborty
Updated on 22-Oct-2019 08:02:29

444 Views

Here we will see how to check whether an unsorted array has duplicate elements within k distance from each other or not. Suppose a list of elements is {1, 2, 3, 1, 4, 5}, here if k = 3, then the program will return true, as the distance between two 1s is 3.We will solve this using a hash table. The steps will be like below −Create one empty hash tableFor each index i, let the element e = arr[i] in the list, doif e is present in the hash table, then return trueotherwise, add e to hash table, and ... Read More

Nokia 3310's Relevance in Today's 4G Smartphone Era

Samual Sam
Updated on 22-Oct-2019 07:59:19

119 Views

Every time your smartphone troubles you all you could think of is the time when things were so simple back. I mean – Yes I like smartphones where you carry a complete package of entertainment, news, and necessity with you. Never to forget the self-camera, apps like WhatsApp, Instagram and Snapchat makes it’s more irresistible. Still being unsatisfied humans we still want more battery backup, better performance, and minimal hanging.In short, we want a merger of our previous type based phone with our new smartphones. Remember the era when mobile phones were first launched? Nokia was the best option we ... Read More

Check if a Doubly Linked List of Characters is Palindrome in C++

Arnab Chakraborty
Updated on 22-Oct-2019 07:54:29

725 Views

Here we will see how to check a string is a palindrome or not using a Doubly linked list. Here we will push each character of a string inside one doubly linked list. There will be two pointers, left and right. Then start scanning from both sides. If a left character is the same as right character, then move the left pointer to the next node, and move the right pointer to the previous node. Otherwise, return false. This process will be continued until the left and right are pointing at the same node, or the right pointer is pointing ... Read More

Check If a Binary Tree Is Subtree of Another Binary Tree in C++

Arnab Chakraborty
Updated on 22-Oct-2019 07:52:12

781 Views

Suppose we have two binary trees. We have to check whether the smaller tree is a subtree of another binary tree or not. Consider these two trees are given.There are two trees. The second tree is the subtree of the first one. To check this property, we will traverse the tree in post-order fashion, then if the subtree rooted with this node is identical to the second tree, then it is subtree.Example Live Demo#include using namespace std; class node {    public:    int data;    node *left, *right; }; bool areTwoTreeSame(node * t1, node *t2) {    if (t1 ... Read More

Check if a Binary Tree is Sorted Level-wise in C++

Arnab Chakraborty
Updated on 22-Oct-2019 07:49:00

153 Views

Here we will see how to check a binary tree is level wise sorted or not. The level wise sorted binary tree will be look like below −In each level, the nodes are sorted from left to right, and each layer contains higher value than its previous level.We can solve this problem by performing level order traversal, and keep track of the minimum and maximum elements of current level. Use another variable prev_max to hold maximum value of the previous level. Then compare the minimum value of current level and maximum value of previous level prev_max. If min value is ... Read More

Industry 4.0: The Changing Face of Manufacturing

Samual Sam
Updated on 22-Oct-2019 07:48:57

380 Views

The industrial landscape is transforming, with technology bridging the gap between the digital and physical world of manufacturing. Loosely being termed as the ‘next Industrial Revolution, ’ systems are being connected intelligently within the entire value chain and support activities of manufacturing; the new face being known as ‘Industry 4.0.’ Over the next decade, Industry 4.0 is expected to add $14.2 trillion to the world economy.SignificanceIndustry 4.0 appositely implies reduced costs, enhanced efficiency and productivity, increased work speed and scale, smarter and proficient products and services. It also refers to the Industrial Internet of Things (IoT). Here, products and services ... Read More

Check Horizontal and Vertical Symmetry in Binary Matrix in C++

Arnab Chakraborty
Updated on 22-Oct-2019 07:46:03

277 Views

Suppose we have a binary matrix of order M x N. The task is to check whether the matrix is horizontally symmetric, vertically symmetric or both. One matrix is said to be horizontally symmetric if the ith row is the same as the (M – i)th row, this is said to be vertically symmetric if the jth column is the same as the (N – j)th column. Suppose the input matrices are like below −011101011This is Horizontally symmetric.111101111This is Vertically symmetric.111101111This is Horizontally as well as vertically symmetric.We will solve this problem using two phases. At first, we will check ... Read More

User Expectations from a Mobile App

Samual Sam
Updated on 22-Oct-2019 07:45:26

277 Views

When the mobile phones were introduced during the initial period of the 21st century, it was a big leap in the communication system. Mobile phones have changed and influenced to the core. This also created a huge market for Mobile Communication, Mobile Phones, Mobile Operating System and Mobile Application. In the mobile communication system, smartphones are considered as the biggest milestone. Smartphones had made the life human beings quite efficient as well bit lazy too.The introduction of Android Operating system by Google was another big leap in mobile systems. Android has created a huge market for the developer to develop ... Read More

IBM Watson: The Supercomputer

Samual Sam
Updated on 22-Oct-2019 07:42:09

301 Views

Do you wish to initiate a new business, need help with business decisions, analyze immense amount of data, create a chatbot or song, need help with recipes, or have a business that is leaving money on the table? Get all your answers from ‘Watson.’Created by IBM, Watson is a supercomputer that works as a ‘question answering’ machine while combining artificial intelligence (AI) along with predictive analytical software. Named after IBM’s founder Thomas J. Watson, it is a cognitive technology that can understand, reason and think like a human.With Watson, through questions designed in natural language, one can analyze, visualize, and ... Read More

Flip Flop Types and Their Conversion in C++

Arnab Chakraborty
Updated on 22-Oct-2019 07:41:03

2K+ Views

Flip-Flops are sequential digital circuits. There are few different types of flip-flops. Here we will see the types of flip-flops and the conversion rules from one flip-flop to another.There are basically four types of flip-flops −SR Flip-FlopD Flip-FlopJK Flip-FlopT Flip-FlopSR Flip-flopSR flip-flop operates with only positive clock transitions or negative clock transitions. Whereas, SR latch operates with enable signal. The circuit diagram of SR flip-flop is shown in the following figure.This circuit has two inputs S & R and two outputs Q(t) & Q(t)’. The operation of SR flipflop is similar to SR Latch. But, this flip-flop affects the outputs ... Read More

Advertisements