Found 27104 Articles for Server Side Programming

Maximum Possible Array Sum after Performing given Operations

Shubham Vora
Updated on 02-Aug-2023 13:47:10

394 Views

In this problem, we will perform the given operations on the array elements and find the maximum sum at last. Here, in each operation, we can select at most X[p] elements from the array and replace them with the Y[p] elements to maximize the sum. In the naïve approach, we will find X[p] array elements, which are smaller than the Y[p] elements, and replace them with Y[p]. In the efficient approach, we will use the priority queue to get the maximum sum. Problem statement − We have given nums[] array containing the N numbers. Also, we have given ... Read More

Maximum Absolute difference between any two Level Sum in a Binary Tree

Shubham Vora
Updated on 02-Aug-2023 13:44:36

101 Views

In this problem, we will find the maximum absolute difference between the sum of all nodes of any two levels. We can use the queue data structure to traverse through each binary tree level. While traversing each level, we can keep track of the maximum and minimum sum and return the absolute difference at last. Problem statement − We have given a binary tree containing the positive and negative integer values. We need to find the maximum absolute difference of the sum of all nodes of any two levels. Sample examples Input ... Read More

What are the different plots available in the Seaborn?

Niharika Aitam
Updated on 02-Aug-2023 11:40:13

94 Views

Seaborn is a powerful data visualization library in Python that builds on top of Matplotlib. It provides a high-level interface for creating attractive and informative statistical graphics. It offers a variety of plot types to explore and visualize data effectively. The below are the different plots available in Seaborn which helps the user to visualize the data. Scatter Plot A scatter plot is used to display the relationship between two numeric variables. In seaborn we have a function namely scatterplot() which creates a scatter plot with optional additional features such as coloring and marker size based on other variables. Line ... Read More

PHP Program to Find the Number Occurring Odd Number of Times

Pradeep Kumar
Updated on 02-Aug-2023 11:36:51

130 Views

What is PHP? PHP (Hypertext Preprocessor) is a widely used server-side scripting language for web development. It allows developers to embed code within HTML files, enabling the creation of dynamic web pages and interactions with databases. PHP is known for its simplicity, versatility, and extensive integration capabilities with popular databases. It offers a broad range of extensions and has a large community of developers, ensuring ample resources and support. PHP Program to Find the Number Occurring Odd Number of Times The concept of "Number Occurring Odd Number of Times" refers to finding a number in an array that ... Read More

Maximize Shortest Path between given Vertices by Adding a Single Edge

Shubham Vora
Updated on 02-Aug-2023 13:42:20

112 Views

In this problem, we will maximize the shortest path between the vertex 1 to N by adding the edge between two selected vertices. Here, we will track the distance of each node of the graph from the 0th and N − 1 nodes. After that, we will insert the single edge between any two selected vertices in such a way that we can maximize the shortest path between 1 to N. Problem statement − We have given an undirected graph. The graph contains the N vertices and M edges. Also, we have given the s_edges[] array containing the K−selected ... Read More

Introduction to pyglet library for game development in Python

Niharika Aitam
Updated on 02-Aug-2023 11:39:42

181 Views

Pyglet is a powerful library for game development and multimedia applications in Python. It provides an easy-to-use interface for creating games, handling graphics, playing audio, and handling user input. It is built on top of the OpenGL library, which allows for high-performance graphics rendering. The following steps to be followed while developing a game using the pyglet library. Installation We can install Pyglet using pip by running the following command in the python environment. Example pip install pyglet Output Collecting pyglet Downloading pyglet-2.0.7-py3-none-any.whl (841 kB) -------------------------------------- 841.0/841.0 kB 2.0 MB/s eta ... Read More

Longest Subarray whose Elements can be Made Equal by Maximum K Increments

Shubham Vora
Updated on 02-Aug-2023 13:40:21

271 Views

In this problem, we will find the length of the longest subarray so that we can make all subarray elements the same by adding some positive integer values, and the sum of added numbers to each element shouldn’t increase than K. The naïve approach is to find the cost of making all elements the same in each subarray of the given array. Finally, consider the length of the subarray whose cost is less than K and the length is maximum. However, we will use the queue data structure to solve the problem efficiently. Problem statement − We have given an ... Read More

Python program to build flashcard using class in python

Niharika Aitam
Updated on 02-Aug-2023 11:38:55

337 Views

Generally, a flashcard is a learning tool that consists of a small card or piece of paper with information printed on one side. These are commonly used to aid in memorization and learning of facts, vocabulary, definitions, equations, or any other type of information that can be presented in a question-and-answer format. With the advancement of technology, flashcards have also been adapted into digital formats, such as mobile apps and online platforms, which provide additional features like multimedia content, spaced repetition algorithms, and progress tracking. There different approaches available in python to build the flash cards, let’s go through each ... Read More

Implementation of a Hypergraph

Shubham Vora
Updated on 02-Aug-2023 13:38:36

144 Views

In this tutorial, we will learn to implement the hypergraph in C++. Definition − The hypergraph is a special version of the graph. In which the single can connect 2 or more vertices. In a normal graph, the single edge can connect only 2 vertices, but a hypergraph is a generalization of the graph and can be used to connect more than 2 vertices with the single edge. In the hypergraph, the edge is called the hyperedge. We can represent the hypergraph with H(E, V), where E is a hyperedge and v is the set of vertices connected by the ... Read More

Python program to apply itertools.product to elements of a list of lists

Niharika Aitam
Updated on 02-Aug-2023 11:38:18

169 Views

The itertools is a module in the Python standard library that provides a collection of tools for efficient iteration and combination of iterables and as it is part of python standard library no need to perform any additional installations. It offers various functions that can be used to manipulate, combine, and iterate over iterables in different ways. The itertools.product() function is related to the itertools module, which is powerful tool for generating the cartesian product of multiple iterables. It takes one or more iterables as input and returns an iterator that produces tuples representing all possible combinations of the ... Read More

Advertisements