Programming Articles - Page 1997 of 3366

Polybius Square Cipher in C++

sudhir sharma
Updated on 17-Apr-2020 08:52:57

1K+ Views

In this problem, we are given a string and we have to find its integer encryption using the Polybius Square Cipher.Polybius Square CipherIt is a table that is used for the conversion of letters into numbers. The table for English encryption is a 5X5 table i.e. contains 25 cells for 26 alphabets of an English dictionary. The letters i and j are kept together in a single cell.The following table shows a Polybius square Cipher −123451ABCDE2FGHI, JK3LMNOP4QRSTU5VWXYZThe letter of the tables can be randomized. Also, the size of the table can be changed based on the number of alphabets of ... Read More

Popular tools for data analytics in C++

sudhir sharma
Updated on 17-Apr-2020 08:43:26

382 Views

Data analytics is the processing of data to extract useful information that supports the machine to make decisions. The processing of data involves cleaning, remodeling, and inspecting data.Data analytics requires high computing power as the data to process is too large. So there are specialized tools for data analytics.Some popular data analytics tools are −R programmingR is one of the best and most widely used tools for data analytics available for all major platforms like Windows, macOS, Unix. It has found usage in data modeling and statistics. Easily manipulation and representation of large data are done using R as it ... Read More

Populate Inorder Successor for all nodes in C++

sudhir sharma
Updated on 17-Apr-2020 08:38:47

285 Views

In this problem, we are given a tree. The structure contains a pointer next. Our task is to populate this pointer with the inorder successor of the node.struct node {    int value;    struct node* left;    struct node* right;    struct node* next; }All the next pointer are set to NULL and we have to set the pointer to the inorder successor of the node.Inorder traversal − This traverses in the following form, Left node -> root Node -> right node.Inorder successor − the inorder successor is the node that comes after the current node is the inorder ... Read More

Portable applications in Cloud and their barriers in C++

sudhir sharma
Updated on 17-Apr-2020 08:16:23

267 Views

Cloud Computing − cloud computing or internet-based computing is storing and accessing of data on virtual servers that are hosted over internet on cloud servers instead of local server.Cloud computing provides the user with an option to use the data on the go. This increases the portability of work i.e. the data and processing of cloud computing can be used anywhere by the user. This is not device and location specific.This feature of cloud computing is important for corporates as they can use cloud services to run projects from virtual locations. The services like IAAS, PAAS, SAAS are used to ... Read More

Position after taking N steps to the right and left in an alternate manner in C++

sudhir sharma
Updated on 17-Apr-2020 08:14:51

650 Views

In this problem, we are given three integers N, A and B. there is a person who is standing at coordinate 0 movesA step towards the right and then B step towards left. Then again right. Our task is to print the final position of the element after N moves.Let’s take an example to understand the problem, Input − N = 4, A = 3, B = 1Output −Explanation −1st move -> right 3, +3 2nd move -> left 1, -1 3rd move -> right 3, +3 4th move -> left 1, -1. Position after 4 moves, +3-1+3-1 = 4.To ... Read More

Position of a person diametrically opposite on a circle in C++

sudhir sharma
Updated on 17-Apr-2020 08:12:41

193 Views

In this problem, we are given two integers N and M. there is a circle and N people are standing on it. M denotes the position of a person. Our task is to print the position of the person opposite to M.Let’s take an example to understand the problem, Input − N = 6, M = 3Output − 6Explanation −To solve this problem, there will be two cases, one if the position is greater than half the position (second half), the opposition will be the first half and vise versa.Let’s create a formula for this mathematically, Case 1 − if ... Read More

Position of rightmost bit with first carry in sum of two binary in C++

sudhir sharma
Updated on 17-Apr-2020 08:10:38

132 Views

In this problem, we are given two positive integers N and M. Our task is to print the rightmost bit that generates the first carry bit in the binary addition of the sum of N and M.Let’s take an example to understand the problem, Input − N = 5, M = 14Output − 3Explanation −(5)2 = 0101 , (14)2 = 1110 Sum 0101 +   1110     10011To solve this problem, we will consider some observations from boolean algebra.The sum will generate a carry when both numbers are 1. So, we will find all bits where carry is generated. ... Read More

Position of rightmost common bit in two numbers in C++

sudhir sharma
Updated on 17-Apr-2020 08:08:26

230 Views

In this problem, we are given two numbers M and N. Our task is to print the position (index) of the rightmost common bit of the two numbers.Let’s take an example to understand the problem, Input − N = 4 , M = 7Output − 3Explanation − (4)2 = 100 , (7)2 = 111. The rightmost common bit is at index 3.To solve this problem, we will have to find all the same bits of the numbers. To find all same bits we will find xor of M and N. Then we will find the rightmost bit in the negation ... Read More

Position of rightmost different bit in C++

sudhir sharma
Updated on 17-Apr-2020 08:06:06

396 Views

In this problem, we are given two numbers N and M. Our task is to find the index of the rightmost different bit in the binary representation of the number.Let’s take an example to understand the problem, Input − N = 12 , M = 9Output − 2Explanation − (12)2 = 1100 and (10)2 = 1010.The second bit from right is a different bit.To solve this problem, we will have to find all the different bits of the numbers. To find all different bits we will find xor of M and N. Then we will find the rightmost bit of M^N.This seems ... Read More

Position of rightmost set bit in C++

sudhir sharma
Updated on 17-Apr-2020 08:03:27

422 Views

In this problem, we are given a number N. Our task is to print the index of the rightmost set bit of the number.Let’s take an example to understand the problem, Input − 4Output − 3Explanation − binary of 4 is 100, the index of the rightmost set bit is 3.To solve this problem, a simple solution would be shifting the number till a set bit is encountered but this could take a lot of computation if the number is large.A more efficient solution will be using boolean algebra. For this we will first calculate 2’s complement of the number, ... Read More

Advertisements