Found 26504 Articles for Server Side Programming

How to create animations in python?

Manthan Ghasadiya
Updated on 10-May-2023 17:33:59

10K+ Views

Python provides several libraries for creating animations, such as Matplotlib, Pygame, and Pyglet. Matplotlib is a popular Python data visualisation library that also offers the functionality of creating animations using the ‘FuncAnimation’ function. ‘FuncAnimation’ is a class in the ‘matplotlib.animation’ module that creates animations by calling a user-defined function. In this tutorial, we will learn animations using the ‘FuncAnimation’ function, and we will illustrate three examples of this method. Syntax animation = FuncAnimation(fig, animate_func, frames=frame_values, interval=interval_value, repeat=repeat_value) In the above syntax, fig is the object that we want to animate, animate_func updates the plot for each frame, ‘frame_values’ is ... Read More

Longest Common Prefix in Linked List

Sakshi Koshta
Updated on 10-May-2023 16:25:54

453 Views

The longest common prefix problem is a well-known computer science problem that is frequently encountered when working with strings or lists. It entails determining the string or list element with the longest common prefix. When it comes to linked lists, there are several approaches that can be taken. One common approach is to traverse the linked list and compare the characters of each node in the list until a mismatch is found. The longest common prefix up to the point of mismatch is considered. Linked List A linear linked list can be defined as a collection of variable number of ... Read More

Queries To Evaluate The Given Equation In A Range [L,R]

Sakshi Koshta
Updated on 10-May-2023 16:23:51

188 Views

The evaluation of all equation in an interval [L, R] give us a range of values for those variables. Examples of how this may be used include modelling, data analysis, and problem-solving scenarios. In this situation, we define equations variable values for all point in range. Hence can be done by specifying the step size of the range and evaluating the equation for each variable value inside the range. Specifications It may be called a request for information asked to database. Data is extracted using specific commands when certain requirements are met. To acquire, filter, sort, and summarize data from ... Read More

Find Values after N Operations to Remove N Characters of String ‘S’ With Given Constraints

Sakshi Koshta
Updated on 10-May-2023 16:19:14

255 Views

What are the Specifications of Using String? To solve a specific challenge involving the given string S. The string S contains only lowercase English letters, and certain constraints must be followed while removing characters. The given constraints are − There are lowercase English letters in string S. A character can only be deleted if it appears more than once in string. Only characters that appear consecutively can be deleted. The following steps can be used to remove characters from string S − Find all characters that appear more than once as you iterate over string S. Find all of ... Read More

Sum of Indices of Characters Removed to Obtain an Empty String Based On Given Conditions

Sakshi Koshta
Updated on 10-May-2023 16:16:46

168 Views

String manipulation-related concepts like The Sum of indices of Characters deleted to obtain an Empty String are frequently utilized in programming challenges and competitions. The result is then computed using the sum of the eliminated characters' indexes. The Sum of indices of Characters deleted to obtain an Empty String is a practical idea in string manipulation that may be used to solve a variety of programming difficulties and challenges. Problem Approach We must first comprehend the problem statement and given criteria to find total of character indices eliminated to produce empty string. Given string S, the objective is to determine ... Read More

Queries to find Kth Greatest Character In A Range [L,R] From A String With Updates

Sakshi Koshta
Updated on 10-May-2023 16:13:37

349 Views

The Fenwick Tree is a type of data structure, which enables range updates and range searches with O(log n) time complexity, also called as binary indexed tree (BIT) The fundamental concept is to keep frequency array for every letter in string, with frequency of i-th character being recorded at index i in frequency array. The frequency array can then allow range updates and range queries using Fenwick Tree. Problem Approach You can use following queries to extract Kth biggest character from string with updates in range [L, R] − Build segment tree − Create segment tree first, in which ... Read More

Queries to count array elements greater than or equal to given number with updates

Sakshi Koshta
Updated on 10-May-2023 16:09:32

752 Views

An array can be successfully updated and put through to range queries thanks to segment trees. With updates, we can use data structure known segment tree to count no. of elements in Array which are larger than or same as no. Query − Find out how many items exist in [l, r] range that are larger than or similar to x. Give 0 if range [l, r] lies entirely beyond segment that current node of segment tree represents. Count no. of elements in range [l, r] which is larger than or similar to x if interval [l, r] ... Read More

Golang program to find minimum value in a stack

Akhil Sharma
Updated on 10-May-2023 12:46:25

313 Views

In Golang, we can find minimum value in a stack by using iterative method and optimized iterative method. A stack is a linear data structure that follows the Last-In-First-Out (LIFO) principle. Syntax func (s *Stack) getMin() int {…} The getMin() function is used to find the minimum value in a stack. It takes a address pointer to the stack as its argument. Algorithm Step 1 − First, we need to import the fmtpackage. Step 2 − Create a stack structure with an item slice to store the stack elements and a min slice to store the minimum ... Read More

Golang program to find floor and ceil in binary search tree

Akhil Sharma
Updated on 10-May-2023 12:44:21

246 Views

A binary search tree (BST) is a type of binary tree where every node has at most two children, commonly referred to as the left child and the right child. In this Golang article, we will learn how to find floor and ceil in binary search tree using recursion and iterative method. The binary search tree is a useful data structure for efficient searching, insertion, and deletion of elements. Syntax func ceil(root *Node, val int) int {…} The ceil() function is used to find the ceil value in the binary search tree. func floor(root *Node, val int) int {…} ... Read More

Golang program to reorder list using recursion

Akhil Sharma
Updated on 10-May-2023 12:43:12

210 Views

A linked list is a data structure consisting of a collection of nodes, where each node contains a value and a pointer to the next node in the list. In this Golang article, we will learn how to reorder list using recursion along with some helper functions. Syntax func reorderList(head *Node) {…} The reorderList() function is used to reorder list using recursion. It takes pointer to the head node as its argument. Algorithm Step 1 − First, we need to import the fmt package. Step 2 − Now, create a struct of a single node of the ... Read More

Advertisements