Prateek Jangid

Prateek Jangid

165 Articles Published

Articles by Prateek Jangid

Page 9 of 17

C++ Return Previous Element in an Expanding Matrix

Prateek Jangid
Prateek Jangid
Updated on 26-Nov-2021 249 Views

Discuss a problem based on expanding the matrix. Expanding matrix is a matrix whose size continuously increases by some factor.Here we have a matrix of characters whose size is expanding by a factor of 2, i.e., if the original size of the matrix is N * N, then the size of the expanded matrix becomes 2N * 2N. We are given a sequence of characters present at ( i, j ), and we need to return the sequence of characters present at (i, (j - N - 1)%N).Let’s understand by visualizing some initial expanded matrix, Given Matrix -> [ a, ...

Read More

Find the Pattern of 1's inside 0's using C++

Prateek Jangid
Prateek Jangid
Updated on 26-Nov-2021 420 Views

In this article we are given values of several rows and several columns. We need to print a Box pattern such that 1’s get printed on 1st row, 1st column, last row, last column, and 0’s get printed on remaining elements. For example −Input : rows = 5, columns = 4 Output :    1 1 1 1    1 0 0 1    1 0 0 1    1 0 0 1    1 1 1 1 Input : rows = 8, columns = 9 Output :    1 1 1 1 1 1 1 1 1   ...

Read More

C++ Reverse a path in BST using queue

Prateek Jangid
Prateek Jangid
Updated on 26-Nov-2021 237 Views

Given a binary search tree, and we are required to reverse its path from a particular key, for example.Approach to Find the SolutionIn this approach, we will make a queue and push all the nodes until we get the root.Example  #include using namespace std; struct node {    int key;    struct node *left, *right; }; struct node* newNode(int item){    struct node* temp = new node;    temp->key = item;    temp->left = temp->right = NULL;    return temp; } void inorder(struct node* root){    if (root != NULL) {        inorder(root->left);        cout ...

Read More

Restoring Division Algorithm For Unsigned Integer in C++

Prateek Jangid
Prateek Jangid
Updated on 26-Nov-2021 2K+ Views

Discuss dividing an unsigned integer using a division algorithm. Some division algorithms are applied on paper, and others are implemented on digital circuits. Division algorithms are of two types: slow division algorithm and fast division algorithm. Slow division algorithm includes restoring, non-performing restoring, SRT, and non-restoring algorithm.In this tutorial, we will discuss the Restoring algorithm, assuming that 0 < divisor < dividend.Approach to Find the SolutionIn this, we will use register Q to store quotient, register A to store remainder, and M to store divisor. The initial value of A is kept at 0, and its value is restored, which ...

Read More

Responsive Video or Slideshow Embeds in Bootstrap with Examples

Prateek Jangid
Prateek Jangid
Updated on 26-Nov-2021 636 Views

Bootstrap is a free open source and is one of the most famous HTML, CSS, and Javascript frameworks. It's used for user interfaces and themes that create what a user sees in a website or application, and it's utilized on the client rather than the server.Responsive web applications automatically adapt to various screen sizes. It is used to create responsive mobile-first web apps and websites; mobile-first refers to designing for smaller displays first and then scaling up to bigger ones. As a result, you won't have to worry about your app not working on different devices or with different screen ...

Read More

Find the Pair with a Maximum Sum in a Matrix using C++

Prateek Jangid
Prateek Jangid
Updated on 26-Nov-2021 319 Views

In this article, we will discuss finding a pair with a maximum sum in a given matrix or 2-D array. For exampleInput : matrix[m][n] = {    { 3, 5, 2 },    { 2, 6, 47 },    { 1, 64, 66 } } Output : 130 Explanation : maximum sum is 130 from element pair 64 and 66. Input : matrix[m][n] = {    { 55, 22, 46 },    { 6, 2, 1 },    { 3, 24, 52 } } Output : 107 Explanation : maximum sum is 130 from element pair 55 and ...

Read More

Find the Pair with Given Sum in a Matrix using C++

Prateek Jangid
Prateek Jangid
Updated on 26-Nov-2021 324 Views

In this article, we will discuss the program of finding a pair with a given sum in a given matrix. For example −Input : matrix[n][m] = {    { 4, 6, 4, 65 },    { 56, 1, 12, 32 },    { 4, 5, 6, 44 },    { 13, 9, 11, 25 } }, SUM = 20 Output : Pair exists. Explanation : Sum = 20 is equal to the sum of numbers 9 and 11 which exists in the matrix. Input : matrix[n][m] = {    { 5, 7, 3, 45 ...

Read More

C++ Representation of a Number in Powers of Other

Prateek Jangid
Prateek Jangid
Updated on 26-Nov-2021 326 Views

Discuss the problem of representing a number in the power of another number. We are given two numbers, x, and y. We need to tell whether y can be represented in the power of x where each power of x can be used once, for exampleInput: x = 4, y = 11 Output: true Explanation: 4^2 - 4^1 - 4^0 = 11 Hence y can be represented in the power of x. Input: x = 2, y = 19 Output: true Explanation: 2^4 + 2^1 + 2^0 =19 Hence y can be represented in the power of x. ...

Read More

Find the Numbers that are not divisible by any number in the range [2, 10] using C++

Prateek Jangid
Prateek Jangid
Updated on 26-Nov-2021 976 Views

In this article, we will discuss the problem to find the numbers from 1 to n(given) which are can not be divided by any number from 2 to 10. Let's understand this with some examples −Input : num = 14 Output : 3 Explanation: There are three numbers, 1, 11, and 13, which are not divisible. Input : num = 21 Output : 5 Explanation: There are five numbers 1, 11, 13, 17, and 19, which are not divisible.Approach to find The SolutionSimple ApproachIf we check every number from 1 to num, whether it can be divided by any ...

Read More

Represent a Number as Sum of Minimum Possible Pseudo-Binary Numbers in C++

Prateek Jangid
Prateek Jangid
Updated on 26-Nov-2021 735 Views

This tutorial will discuss the representation of a number as a sum of minimum pseudo-binary numbers. Pseudo-binary numbers are the numbers that consist of only binary digits, i.e., 0 and 1. Examples of pseudo-binary numbers are 00, 11, 10, 100, 111, 1011, etc.Below are some examples of numbers represented as the sum of pseudo-binary numbers.Input : 23 Output : 11 + 11 + 1 Explanation : 23 = 11 + 11 + 1, sum of pseudo-binary numbers(11, 11, 1) is 23. Input : 50 Output : 10 + 10 + 10 + 10 + 10Approach to Find the SolutionBelow ...

Read More
Showing 81–90 of 165 articles
« Prev 1 7 8 9 10 11 17 Next »
Advertisements