- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 7347 Articles for C++
![sudhir sharma](https://www.tutorialspoint.com/assets/profiles/125719/profile/60_65058-1565947418.jpg)
581 Views
Fermat’s little theorem −This theorem states that for any prime number p, Ap - p is a multiple of p.This statement in modular arithmetic is denoted as, ap ≡ a (mod p)If a is not divisible by p then, ap - 1 ≡ 1 (mod p)In this problem, we are given two numbers a and p. Our task is to verify fermat’s little theorem on these values.We need to check if ap ≡ a (mod p) or ap - 1 ≡ 1 (mod p)Holds true for the given values of a and p.Let’s take ... Read More
![sudhir sharma](https://www.tutorialspoint.com/assets/profiles/125719/profile/60_65058-1565947418.jpg)
161 Views
Fermat’s last theorem in number theory also known as Fermet’s conjecture is a theorem that states that for power n greater than 2. No three values a, b, c satisfy − an + bn = cni.e. if n 32 + 42 = 9 + 16 = 25 = 52. 5, 12, 13 => 25 + 49 = 169 = 132.In this problem, we are given three values, L, R, pow denoting range [L, R] and power. Our task is to verify the fermat’s last theorem for the given range and power.Let’s take an example to understand the problem, ... Read More
![sudhir sharma](https://www.tutorialspoint.com/assets/profiles/125719/profile/60_65058-1565947418.jpg)
238 Views
Database Management System or DBMS in short refers to the technology of storing and retrieving usersí data with utmost efficiency along with appropriate security measures.Federated Database management system is a special type of DBMS in which transparently maps more that one autonomous database into one database which is federated database.The federated database management system is useful while working with multiple applications that uses federation of databases.There are some issues with the federated database management system. They are −Managing the difference in data models, while working with federated databases multiple applications can have different type of data models and dealing with these ... Read More
![sudhir sharma](https://www.tutorialspoint.com/assets/profiles/125719/profile/60_65058-1565947418.jpg)
2K+ Views
In this problem, we are given an integers x. Our task is to calculate Fast inverse square root () of a 32-bit floating point number. The algorithm to find the inverse square root of the number is of great use in programming, such as vector normalization in video games, in 3D graphics, etc. Algorithm: Step 1: The algorithm converts the floating point value to integer. Step 2: Operate on the integer value and return approximate value of the inverse square root.Step 3: Convert the integer value back to floating point using the same method used in step 1.Step 4: The approximation is made for improving precision using ... Read More
![sudhir sharma](https://www.tutorialspoint.com/assets/profiles/125719/profile/60_65058-1565947418.jpg)
315 Views
In this problem, we are given two numbers A and B. Our task is to create a program to calculate the Fast average of two numbers without division. Let’s take an example to understand the problem, Input: A = 34 B = 54Output: 44Solution Approach: Normally, the average is calculated by adding two numbers and then divide it by 2. This requires division but we need to find the average without using division. This can be done using right shift operator >> and shift the binary expansion instead of using division operator.Program to illustrate the working of our solution, ExampleLive Demo#include ... Read More
![sudhir sharma](https://www.tutorialspoint.com/assets/profiles/125719/profile/60_65058-1565947418.jpg)
2K+ Views
External Sorting is a category of sorting algorithm that is able to sort huge amounts of data. This type of sorting is applied on data set which acquire large memory which cannot be holded in main memory (RAM) and is stored in secondary memory ( hard disk).The idea of sorting used in external sort is quite similar to merge sort. In also possess two phases like in merge sort, In the sort phase, small memory size data sets are sorted and then in merge phase, these are combined to a single dataset.External Sorting For a huge data set which cannot be processed in ... Read More
![sudhir sharma](https://www.tutorialspoint.com/assets/profiles/125719/profile/60_65058-1565947418.jpg)
619 Views
Relational data model is the primary data model, which is used widely around the world for data storage and processing. This model is simple and it has all the properties and capabilities required to process data with storage efficiency.They are basic operators on Relation Algebra, here we will learn about some extended operators. They are mainly of three types:Intersection Join Divide Intersection Operation i s a special type of operation in for relations R1 and R2 where the relation in which the tuples with elements present in both relations i.e. in relation R1 and R2. JOIN Conditional Join is a special type of join in which we ... Read More
![sudhir sharma](https://www.tutorialspoint.com/assets/profiles/125719/profile/60_65058-1565947418.jpg)
84 Views
Midy’s Theorem is a statement used for decimal expansion of numbers denoted by n/p, where n is any number and p is a prime number and a/p has a repeating decimal with even period.In Extended Midy’s Theorem, the repeating portion is divided into m digits, then their sum is a multiple of 10m - 1. Program to illustrate Extended Midy’s Theorem: ExampleLive Demo#include using namespace std; string findDecimalValue(int num, int den) { string res; unordered_map mp; int rem = num % den; while ((rem != 0) && (mp.find(rem) == mp.end())) { ... Read More
![sudhir sharma](https://www.tutorialspoint.com/assets/profiles/125719/profile/60_65058-1565947418.jpg)
333 Views
An expression tree is a special type of binary tree in which each node of the tree either consists of an operator or operand.Leaf nodes of the tree represent an operand.Non-leaf nodes of the tree represent an operator.Example:To get the infix expression which can be easily solved, we need to traverse the tree using inorder traversal.
![sudhir sharma](https://www.tutorialspoint.com/assets/profiles/125719/profile/60_65058-1565947418.jpg)
294 Views
In this problem, we are given an odd number N. Our task is to express an odd number as the sum of prime numbers.There can be at max three prime numbers while expressing the number.Let’s take an example to understand the problem, Input: N = 55Output: 53 + 2Solution Approach: The odd number can be represented as a sum of primes. Taking these primes into consideration we have three cases.Case 1: If n is a prime number, it is represented as the sum of one prime number n.Case 2: If (n - 2) is a prime number, it is represented as the sum of two ... Read More