Dev Prakash Sharma has Published 548 Articles

Python Program to Construct an Expression Tree of a given Expression

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 23-Feb-2021 18:49:16

3K+ Views

Expression trees are those in which the leaf nodes have the values to be operated, and the internal nodes contain the operator on which the leaf node will be performed.Example: 4 + ((7 + 9) * 2) will have an expression tree like -Approach to solve this ProblemIn order to construct ... Read More

Find the Intersection Point of Two Linked Lists in Java

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 23-Feb-2021 18:42:34

630 Views

A Linked List is a linear data structure in which each node has two blocks such that one block contains the value or data of the node and the other block contains the address of the next field.Let us assume that we have a linked list such that each node ... Read More

Find the Nth Ugly Number in Java

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 23-Feb-2021 18:37:00

1K+ Views

A number whose prime factors are either 2, 3 or 5 is called an Ugly Number.  Some of the ugly numbers are: 1, 2, 3, 4, 5, 6, 8, 10, 12, 15, etc.We have a number N and the task is to find the Nth Ugly number in the sequence ... Read More

Selection Sort in Go Lang

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 23-Feb-2021 18:27:34

2K+ Views

Selection sort is a sorting algorithm that is used to sort the elements by repeatedly finding the minimum element and placing it at the first in the unsorted part of the array. After placing the minimum element in one end of the array, the array is then divided into two ... Read More

How to align multiple plots in a grid using GridSpec Class in Matplotlib

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 23-Feb-2021 18:22:08

964 Views

Aligning the multiple plots in a grid can be very messy and it can create multiple issues like higher width and height or minimal width to align all the plots. In order to align all the plots in a grid, we use GridSpec class.Let us suppose that we have a ... Read More

Plotting regression and residual plot in Matplotlib

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 23-Feb-2021 18:14:13

2K+ Views

To establish a simple relationship between the observations of a given joint distribution of a variable, we can create the plot for the regression model using Seaborn.To fit the dataset using the regression model, we have to first import the necessary libraries in Python.We will create plots for each regression ... Read More

Algorithm to construct an Expression Tree in Data Structure

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 23-Feb-2021 18:11:51

8K+ Views

Expression treesExpression trees are those in which the leaf nodes have the values to be operated, and internal nodes contain the operator on which the leaf node will be performed.Example4 + ((7 + 9) * 2) will have an expression tree as followsAlgorithm to Construct an Expression TreeLet T be the ... Read More

Daily Temperatures in C++

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 23-Feb-2021 15:26:08

445 Views

Let us suppose we have an array of positive temperatures which represent the temperatures T. The task is to calculate how many days are there for the next warmer temperature in the given list.For exampleInput-1: T = [ 73, 74, 75, 71, 69, 72, 76, 73]Output: [1, 1, 4, 2, 1 ,1 ... Read More

How to Capture a pick event and use it to activate or deactivate Line Plots in Matplotlib

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 23-Feb-2021 14:52:11

531 Views

After enabling the pick event property of artists in Matplotlib, the task is to use the pick event to enable and disable the line plots for a given axis in a set of plots.In order to pick a specific line plot, we use Legend.We will use a Binary classification plot ... Read More

How to add annotations in Matplotlib Plots?

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 23-Feb-2021 14:50:37

428 Views

To specify the details of a plot, we use annotations. To create annotations in Matplotlib Plots, we can use the ‘annotate’ method.Exampleimport matplotlib.pyplot as plt import numpy as np #Let us create a plot and use annotation at the point (5, 3), x = np.arange(0, 4*np.pi, 0.1) ... Read More

Advertisements