Found 27104 Articles for Server Side Programming

Highlight Pandas DataFrame's Specific Columns using Apply()

Shriansh Kumar
Updated on 21-Jul-2023 18:19:33

1K+ Views

While presenting or explaining some facts using Pandas DataFrame, we might need to highlight important rows and columns of the given data that help in making them more appealing, explainable and visually stunning. One way of highlighting the Pandas DataFrame's specific columns is by using the built-in method apply(). Python Program to Highlight Pandas DataFrame using apply() Before jumping to the example program directly, it is necessary to discuss the basics of Pandas and apply(). Pandas It is an open-source Python library that is mainly used for data analysis and manipulation. It can handle both relational ... Read More

Hierarchical Data in Pandas

Shriansh Kumar
Updated on 25-Jul-2023 12:21:50

2K+ Views

Hierarchical data is often used to represent multiple levels of nested groups or categories. For example, a company may have a hierarchy of employees, departments, and locations. A product may have a hierarchy of categories and subcategories. One of the challenges of working with hierarchical data is how to represent it in a tabular format which can make it easy to manipulate and analyze. In this article, we are going to present hierarchical data using Pandas' built-in methods like 'set_index()' and 'groupby()'. Python Program to Represent Hierarchical Data using Pandas First, let's briefly discuss Pandas and its ... Read More

Length of Longest Increasing Subsequences (LIS) using Segment Tree

Way2Class
Updated on 21-Jul-2023 17:45:08

272 Views

Segment Tree is a versatile data structure designed for answering range queries and performing updates on arrays in logarithmic time complexity, where each node stores information related to a specific range of elements in the array. In the context of the Longest Increasing Subsequence (LIS) problem, which requires determining the length of the longest subsequence of a given sequence in which the elements are sorted in increasing order, Segment Trees can be utilized to efficiently compute the Length of Longest Increasing Subsequences in an array. This approach significantly reduces the time complexity compared to traditional methods and has ... Read More

Classification of Algorithms with Examples

Way2Class
Updated on 21-Jul-2023 17:39:00

237 Views

Classification of algorithms helps in selecting the most suitable one for a specific task, enabling developers to optimize their code and achieve better performance. In computer science, algorithms are sets of well-defined instructions used to solve problems or perform specific tasks. The efficiency and effectiveness of these algorithms are crucial in determining the overall performance of a program. In this article, we will discuss two common approaches for classifying algorithms, namely, based on their time complexity and based on their design technique. Syntax The syntax of the main function used in the codes for both approaches − int ... Read More

Count K-length subarrays whose average exceeds the median of the given array

Way2Class
Updated on 21-Jul-2023 17:20:50

66 Views

The expression "K-length subarrays" pertains to successive subarrays having precisely K elements. Grasping and working with subarrays is crucial for resolving various issues in fields such as dynamic programming, computational geometry, and data analysis. Another vital concept in array manipulation and statistics is the median. The median of an array represents the middle value when the elements are sorted in ascending order. In the case of an even number of elements, the median is the average of the two central values. The median constitutes a durable measure of central tendency, as it is less vulnerable to extreme values or outliers ... Read More

Plot Multiple lines in Matplotlib

Shriansh Kumar
Updated on 21-Jul-2023 17:51:34

6K+ Views

Python provides a powerful library named Matplotlib that creates visual representations in the form of plots and graphs. One of the many features of this library is the ability to plot multiple lines in a single graph that are useful in comparing data sets or visualizing trends over time. We are going to explore the built-in method named 'plot()' that is used for plotting multiple lines in Python Matplotlib. Python Program to Plot Multiple lines in Matplotlib Before jumping to the program directly, let's familiarize ourselves with some basic concepts of Python that will help us ... Read More

Queries to find the Minimum Weight from a Subtree of atmost D-distant Nodes from Node X

Way2Class
Updated on 21-Jul-2023 17:16:23

52 Views

When engaged in computer programming, it is sometimes necessary to locate the minimum weight of a subtree that originates from a specific node, with the condition that the subtree must not contain any nodes farther than D units away from the specified node. This problem arises in various fields and applications, including graph theory, tree-based algorithms, and network optimization. The subtree constitutes a subset of a larger tree structure, with the specified node serving as the root of the subtree. The subtree encompasses all the descendants of the root node and their connecting edges. The weight of a node refers ... Read More

Queries to find the Lower Bound of K from Prefix Sum Array with updates using Fenwick Tree

Way2Class
Updated on 21-Jul-2023 17:13:16

98 Views

A foremost series summation array is an assemblage that accumulates the sum of interlacing elements up to an express index. It is a widely utilized tactic in the reconfiguration of assemblages to refine time complexity. Fenwick Tree, also recognized as Binary Indexed Tree (BIT), is a form of database that proficiently modernizes components and computes a preceding series summation in logarithmic time complexity. Within this article, we shall confer on how to disclose the lesser extreme boundary of a given value, referred to as K, from a series summation array with modernizations utilizing Fenwick Tree in C++. Syntax The ... Read More

Queries to check if vertices X and Y are in the same Connected Component of an Undirected Graph

Way2Class
Updated on 21-Jul-2023 17:00:04

162 Views

Graph theory encompasses the study of connected components, which are subgraphs in an undirected graph where every pair of vertices is linked by a path, and no other vertices are connected to it. In this article, we will delve into the utilization of the C/C++ programming language to determine if two vertices, X and Y, belong to the same connected component in an undirected graph. We will elucidate the syntax and rationale of the method before elucidating at least two diverse approaches to tackle this problem. Furthermore, we will provide concrete code examples and their corresponding outcomes for each ... Read More

Plot Multiple Plots in Matplotlib

Shriansh Kumar
Updated on 21-Jul-2023 17:49:45

2K+ Views

Python provides a powerful library named Matplotlib that creates visual representations in the form of plots and graphs. One of the many features of this library is the ability to plot multiple plots within a single figure that are useful when comparing different datasets or visualizing relationships between multiple variables. We are going to explore the built-in method named 'subplots()' of Matplotlib that is used to plot multiple plots. Python program to plot multiple plots in Matplotlib Before jumping to the program directly let's familiarize ourselves with subplots() method of Matplotlib. subplots() method With a single ... Read More

Advertisements