Check If a Linked List is Circular Linked List in C++

Arnab Chakraborty
Updated on 22-Oct-2019 11:28:11

2K+ Views

Here we will see, hoe to check a linked list is circular linked list or not. To check whether the linked list is circular or not, we will store the header node into some other variable, then traverse the list, if we get null at the next part of any node, then that is not circular, otherwise we will check the next node is same as the stored node or not, if so then that is circular.Example Live Demo#include using namespace std; class Node{    public:    int data;    Node *next; }; Node* getNode(int data){    Node *newNode = ... Read More

Install and Configure Puppet 4 on Ubuntu 16.04

Samual Sam
Updated on 22-Oct-2019 11:26:20

212 Views

In this article, we will learn – How to install and configure the Puppet 4 on Ubuntu 16.04. Puppet is a configuration management tool which helps in the automation of tasks with respect to system administrators. These type of tools will save a lot of time and effort too.Pre-requisitesHere in this article, we need at least two to three Ubuntu machines with the following requirements.All the machines with a non-root user with Sudo permissions on the machine.One Puppet masterOne or two puppet agents to test the configuration.Configuring the Host FilesAll the server and clients needed to communicate with the host ... Read More

Check If a Large Number is Divisible by 13 in C++

Arnab Chakraborty
Updated on 22-Oct-2019 11:24:35

375 Views

Here we will see how to check a number is divisible by 13 or not. In this case the number is very large number. So we put the number as string.A number will be divisible by 13, if the number satisfies the following situations −A number is divisible by 13 if and only if we get the alternating sum i.e. alternatively adding and subtracting of blocks of three numbers from right to left is divisible by 13. For example, 2911285 is divisible by 13 because the alternating sum of blocks of size 3 is 2 – 911 + 285 = ... Read More

Why Did Intel Abandon the Promising Atom Project?

Samual Sam
Updated on 22-Oct-2019 11:22:42

642 Views

As of now, Intel is taking few of the last breaths left in the colossally competitive smartphone and tablet market. Intel drained out millions and billions of dollars in developing and marketing its mobile processor department. The PC chip manufacturer couldn’t stand a chance when it had to face the likes of Qualcomm and Mediatek as per my opinion.Inside IntelAccording to an Intel spokesperson, the company had to cancel two of its Atom-based chips immediately. These chips were code-named, Sofia and Broxton. These are perhaps the first few products that Intel has terminated for bringing in a revamp in its ... Read More

Tough to Manage Quality? Focus on Planning

Samual Sam
Updated on 22-Oct-2019 11:20:53

127 Views

Quality is the key to achieving success, whether it is a tiny pin or a huge ship, the buyer wouldn’t buy your product if it is degraded in quality. Even, when we go to any supermarket to purchase our daily needs, the first thing we do is to check the quality before placing the order. And, sometimes we won’t mind paying some extra bucks buying a high-quality product instead of choosing a cheaper one.The quality of a product can be assessed more appropriately when end users actually use that product. But imagine, what will be the impact of a low-quality ... Read More

Check If a Large Number Can Be Divided Into Equal Sum Segments in C++

Arnab Chakraborty
Updated on 22-Oct-2019 11:20:20

157 Views

Here we will see a program, that can check whether a number can be divided into more than one segments with equal sum. Suppose a number is like 74325, then this can be segmented into three parts (7), (4, 3), (2, 5), all are of same um value.We have to follow these steps to solve this problem.Take the number as stringuse an array to hold prefix sum of the arrayNow traversing from second element to last element, and the first segment will be 0 to i-1, whose sum will be placed at prefix_sum[i - 1]Use another variable which traverses from ... Read More

Check If a Given Number is Pronic in C++

Arnab Chakraborty
Updated on 22-Oct-2019 11:16:34

887 Views

Here we will see, how to check whether a number is Pronic number or not. A number that can be arranged to form a rectangle, are called the pronic numbers. First few pronic numbers are: 0, 2, 6, 12, 20, 30, 42, 56, 72, 90, 110, 132, 156, 182, 210, 240, 272, 306, 342. The pronin numbers are product of two consecutive integers. So a pronic number n = x * (x + 1).Here we will check and generate some pronic numbers.Example Live Demo#include #include using namespace std; bool isPronicNumber(int num) {    for (int i = 0; i

Check If a Given Number Divides the Sum of the Factorials of Its Digits in C++

Arnab Chakraborty
Updated on 22-Oct-2019 11:14:52

167 Views

Suppose, we have an integer, we have to find if the number divides the sum of the factorial of its digits. Suppose a number is 19, the sum of factorial of digits is (1! + 9!) = 362881, this is divisible by 19.To solve this, we will take the number, then calculate factorial of each digit and add the sum, if the sum is divisible by the number itself, then return true, otherwise false.Example#include using namespace std; int factorial(int n){    if(n == 1 || n == 0)       return 1;    return factorial(n - 1) * ... Read More

Check If a Given Number Can Be Represented in Given Digits in Any Base in C++

Arnab Chakraborty
Updated on 22-Oct-2019 11:11:40

161 Views

Suppose we have a number n, and number of digits d. We have to check whether the number n can be represented as d digit number in any base from 2 to 32. Suppose the number n is 8, and d = 4, then this can be represented as 1000 in binary, here the d is 4.The idea is to check all bases one by one from 2 to 32. We can follow these steps to check the base.If the number is smaller than base, and digit is 1, then return trueif digit is more than one and number is ... Read More

Check If a Given Mobile Number is Fancy in C++

Arnab Chakraborty
Updated on 22-Oct-2019 11:09:16

617 Views

We have a 10 digit mobile number, our task is to check whether the number is fancy number or not. There are three different conditions for a fancy number. If at least one is true, then the number is fancy. These conditions are like below −A single number occurs three consecutive times, like 555Three consecutive numbers are either in increasing or decreasing order like 123 or 321.A single digit occurs four or more times in a number, like 8965499259, here 9 has occurred four times.One example of fancy number is 9859009976, this is a fancy number as the third condition ... Read More

Advertisements