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
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
In this article, we have an array containing distinct elements. We need to print the pairs of positive-negative values in the array with the same absolute value and print them in sorted order for examples −Input : arr[] = { 1, -1, 11, 12, 56, 77, -56, -12, -88} Output : -1 1 -12 12 -56 56 Input : arr[] = {30, 40, 50, 77, -51, -50, -40} Output : -40 40 -50 50Approach to find The SolutionThe first approach that comes to our mind is the Brute Force approach, and we make up another one called the Efficient ... Read More
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
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
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
Bootstrap is a front-end framework meaning that it’s used on the client, not the server, and it’s specifically used for user interfaces and themes that design what the user sees in a website or application.It included bits of code and HTML, CSS, and also javascript. It is used for building responsive mobile-first web applications and websites; mobile-first means it refers to design for smaller screens first and then working and then working up to the larger screens.In Bootstrap, we have different classes for making the other appearances of images and making them responsive to scale according to their parent class.Let’s ... Read More
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
Discuss how to recover the root password of Linux without using any external media. The version of Linux we are working with is CentOS version 8.2. Still, the procedures we will see can work with any Linux distro and many others. You may find that it doesn’t work with some Debian-based distro.To do this exercise, you should have the following requisites Prerequisites −Willingness to work in the Linux command line environment.Physical access to the Linux server(it cannot do this across a network).Procedures to follow to change the root passwordRestart the computer and interrupt the boot process at the grub screen ... Read More
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
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP