To set the value of the axis multiplier in matplotlib, we can take the following steps −StepsSet the figure size and adjust the padding between and around the subplots.Create x data points using numpy.Plot x and x2 using plot() method.Get the current axis of the figure.Initialize a variable multiplier, i.e., a value of the axis multiplier.Set a tick on each integer multiple of a base within the view interval.Set the locator of the major ticker.To display the figure, use show() method.Example# Import matplotlib and numpy from matplotlib import pyplot as plt import numpy as np # Set the figure ... Read More
PL/SQL is a combination of SQL along with the procedural features of programming languagesFLOYD’s triangle − it is a triangle formed by natural numbers. It is the triangle formed by filling numbers in rows starting from 1 at the top-left corner. It is a right-angled triangle i.e. the count of numbers in each row is the same as the row number.In this problem, we are given a natural number N. Our task is to create Floyd’s triangle in PL/SQL.Let’s take an example to understand the problemInput: 16 Output: 1 2 3 4 5 6 7 8 9 10 11 12 ... Read More
In this problem, we are given an array arr[] consisting of N numbers and an integer value x. Our task is to create a program for finding the first element greater than or equal to X in the prefix sum of N numbers using Binary Lifting.Prefix Sum of elements of an array is an array whose each element is the sum of all elements till that index in the initial array.Example − array[] = {5, 2, 9, 4, 1}prefixSumArray[] = {5, 7, 16, 20, 21}Let's take an example to understand the problem, Input: arr[] = {5, 2, 9, 4, 1}, ... Read More
In this problem, we are given an array arr[] of integer elements. Our task is to create a program to find the Floor of every element in the same array. If the floor of an element exists, we will print the floor otherwise print -1.Floor of an element in array is the closest element which is smaller than or equal to the element in the array.Let’s take an example to understand the problemInput: arr[] = {3, 1, 5 ,7, 8, 2} Output: 2 -1 3 5 7 1Solution ApproachAn approach to solve the problem is by using nested loops. One ... Read More
In this problem, we are given a directed graph represented as an adjacency list. Our task is to create a program for finding the path from one vertex to rest using BFS.BFS(Breadth First Search) is an algorithm that traverses a graph in a breadthward motion and uses a queue to remember to get the next vertex to start a search, when a dead end occurs in any iteration.Let's take an example to understand the problem,Input −OutputSA
In this problem, we are given a sorted array arr[] and an integer value x. Our task is to create a program to find the floor in a sorted array.Floor of X in sorted array arr is the largest element of the array arr[] which is smaller than or equal to x.Let’s take an example to understand the problemInput: arr[] = {2, 5, 6, 8, 9, 12, 21, 25}, x = 10 Output: 9Explanation − In the above array 9 is the largest number which is smaller than or equal to 10.Solution ApproachA simple solution to the problem is directly ... Read More
In this problem, we are given a N*N matrix mat[]. Our task is finding the maximum square sub-matrix with all equal elements.In this problem, we need to find the maximum size of a sub-matrix from the given matrix whose all elements are the same.Let's take an example to understand the problem, Input: mat[][] = {{1, 2, 1}, {1, 2, 2}, {2, 2, 2}} Output: 2Explanation −matrix a11, a12, a21, a22 is of size 2X2 and forms a sub-matrix with all equal elements. Solution ApproachA simple solution to the problem is by traversing all the elements of the matrix and then ... Read More
In this problem, we are given a number N. Our task is to finding sum of first n natural numbers in PL/SQL.PL/SQL is a combination of SQL along with the procedural features of programming languages.PL/SQL has the following features −PL/SQL is tightly integrated with SQL.It offers extensive error checking.It offers numerous data types.It offers a variety of programming structures.It supports structured programming through functions and procedures.It supports object-oriented programming.It supports the development of web applications and server pages.PL/SQL has the following advantages −SQL is the standard database language and PL/SQL is strongly integrated with SQL. PL/SQL supports both static and ... Read More
Softwares are a set of programs that are created in order to perform a specific computer task. Generally, the software is created by developers to solve the needs of its users. And based on the restrictions that are imposed on software. Basically, there are a few categories based on licensing. Here, we will compare two types: Freeware and Shareware.Freeware SoftwareThese softwares are the softwares that are available to the users free of cost to use and distribute. The source code of the software is not available to use and cannot be modified.Shareware SoftwareThese softwares are the softwares that are initially ... Read More
In this problem, we are given a positive integer N denoting the number of friends in a group. Our task is to create a program to solve the Friends Pairing Problem.Each friend of the group can either remain single or can pair up with one other friend. The pairing of each friend of the group can be done only once.Let’s take an example to understand the problemInput: n = 3 Output: 4 Explanation: Let’s say the 3 members of the group are A, B and C. The pairing can be done as : {A}, {B}, {C} {A, B}, {C} {A, ... Read More