
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 7197 Articles for C++

204 Views
Here we shall discuss a C++ program to find the Longest Subsequence Common to All Sequences in a Set of Sequences.AlgorithmsBegin Take the array of strings as input. function matchedPrefixtill(): find the matched prefix between string s1 and s2 : n1 = store length of string s1. n2 = store length of string s2. for i = 0, j = 0 to i

2K+ Views
The Kadane's algorithm is used to find the maximum subarray sum in a given array of integers. This section will explain the Kadane's algorithm with example and C++ implementation. Given an array of integers, our task is to find the maximum possible sum for a subarray using Kadane's algorithm. For example:ScenarioConsider the following example with input/output scenario: Input: [-2, 1, -3, 4, -1, 2, 1, -5, 4] Output: 6 Explanation: The subarray [4, -1, 2, 1] has the largest sum = 6. What is Kadane's Algorithm? Kadane's algorithm is an optimized method to find the maximum ... Read More

3K+ Views
In the Affine cipher, each letter in an alphabet is mapped to its numeric equivalent, is a type of monoalphabetic substitution cipher. Encryption is done using a simple mathematical function and converted back to a letter.The letters of an alphabet of size m are first mapped to the integers in the range 0 … m-1, in the Affine cipher, The ‘key’ for the Affine cipher consists of 2 numbers, a and b. a should be chosen to be relatively prime to m.EncryptionTo transform the integer, it uses modular arithmetic that each plaintext letter corresponds to into another integer that correspond ... Read More

8K+ Views
Vigenere Cipher is a kind of polyalphabetic substitution method of encrypting alphabetic text.Vigenere Cipher Table is used in which alphabets from A to Z are written in 26 rows, for encryption and decryption in this method.EncryptionKey: WELCOMEMessage: ThisistutorialspointHere we have to obtain a key by repeating the given key till its length becomes equal to original message length.For encryption take first letter of message and key i.e. T and W. Take the alphabet in Vigenere Cipher Table where T row and W column coincides i.e. P.Repeat the same process for all remaining alphabets in message text.Finally, the encrypted message text ... Read More

8K+ Views
Based on linear algebra Hill cipher is a polygraphic substitution cipher in cryptography.To encrypt message: The key string and message string are represented as matrix form. They are multiplied then, against modulo 26. The key matrix should have inverse to decrypt the message.To decrypt message: The encrypted message is multiplied by inverse key matrix used for encryption against modulo 26 to get decrypt message.For exampleKey matrix1 0 1 2 4 0 3 5 6Message string ‘ABC’ in matrix form −0 1 2For encryptionAfter multiplying above two matrices we get, 2 4 17Which will be the encrypted message ‘CER’For decryptionInverse of ... Read More

18K+ Views
RSA is an asymmetric cryptography algorithm which works on two keys-public key and private key.AlgorithmsBegin 1. Choose two prime numbers p and q. 2. Compute n = p*q. 3. Calculate phi = (p-1) * (q-1). 4. Choose an integer e such that 1 < e < phi(n) and gcd(e, phi(n)) = 1; i.e., e and phi(n) are coprime. 5. Calculate d as d ≡ e−1 (mod phi(n)); here, d is the modular multiplicative inverse of e modulo phi(n). 6. For encryption, c = me mod n, where m = original message. 7. For ... Read More

484 Views
In this scheme, pairs of letters are encrypted, instead of single letters as in the case of simple substitution cipher.In playfair cipher, initially a key table is created. The key table is a 5×5 grid of alphabets that acts as the key for encrypting the plaintext. Each of the 25 alphabets must be unique and one letter of the alphabet (usually J) is omitted from the table as we need only 25 alphabets instead of 26. If the plaintext contains J, then it is replaced by I.The sender and the receiver deicide on a particular key, say ‘tutorials’. In a ... Read More

6K+ Views
In this scheme, pairs of letters are encrypted, instead of single letters as in the case of simple substitution cipher.In playfair cipher, initially a key table is created. The key table is a 5×5 grid of alphabets that acts as the key for encrypting the plaintext. Each of the 25 alphabets must be unique and one letter of the alphabet (usually J) is omitted from the table as we need only 25 alphabets instead of 26. If the plaintext contains J, then it is replaced by I.The sender and the receiver deicide on a particular key, say ‘tutorials’. In a ... Read More

28K+ Views
It is a mono-alphabetic cipher wherein each letter of the plaintext is substituted by another letter to form the ciphertext. It is a simplest form of substitution cipher scheme.This cryptosystem is generally referred to as the Shift Cipher. The concept is to replace each alphabet by another alphabet which is ‘shifted’ by some fixed number between 0 and 25.For this type of scheme, both sender and receiver agree on a ‘secret shift number’ for shifting the alphabet. This number which is between 0 and 25 becomes the key of encryption.The name ‘Caesar Cipher’ is occasionally used to describe the Shift ... Read More

874 Views
An automaton with a finite number of states is called a Finite Automaton. We can use a Finite State Automaton (FSA) to perform optimized pattern search operation on a string. This article will discuss how to implement a Finite State Automaton based search in C++. Problem Statement: Given two strings text[] and pattern[], we want to find all occurrences of the pattern in the text using a Finite State Automaton. // Input Strings text[] = "tutorialsPoint provides premium tutorials on various topics" pattern[] = "tutorials" // Output Pattern found at index 0 and 32 Finite State ... Read More