String expression evaluation
It can carry out addition, subtraction, multiplication and division, exponential operation, power operation, factorial operation, trigonometric function operation and logarithmic function operation.
Because the previous ones are easy to handle, here I mainly explain that the operation of trigonometric function and logarithmic function can adop ...
Added by tdnxxx444 on Sat, 12 Feb 2022 15:11:26 +0200
Single source shortest path exercise
Mapping method of single source shortest path
Heat Wave
Title Link: Heat Wave Analysis: for a relatively naked problem, directly build a drawing and set a template, and I will directly use spfa water. Code implementation:
#include<iostream>
#include<queue>
#include<cstring>
using namespace std;
const int N=2510,M=12410; ...
Added by reag27 on Sat, 12 Feb 2022 14:16:52 +0200
Breadth first and depth first
This weekend, on a whim, I opened LeetCode to do a question: https://leetcode-cn.com/problems/number-of-enclaves/ Seeing the question, my first thought is: Start with the land on the edge and find its largest connected area. Set the marker bit for the found connected area to avoid duplication. After all the connecting areas of marginal land are ...
Added by dnast on Sat, 12 Feb 2022 11:22:22 +0200
GDUT ACM2022 winter vacation training topic II D E (01 backpack)
For a better reading experience, please go to: Paxton's little broken station
1, 01 Backpack
01 backpack is to take out several items from M items and put them in a backpack with space W. the volume of each item is W1, W2 to Wn, and the corresponding value is P1,P2 to Pn. 01 knapsack is the simplest problem in knapsack problem. 01 the ...
Added by Bijan on Sat, 12 Feb 2022 09:00:17 +0200
Multiple knapsack and its optimization
Problem description
There are n kinds of goods, which have their own volume, value and certain quantity. How to maximize the total value of the items loaded in the backpack with a given capacity?
Algorithmic thought
Before solving the problem, for the convenience of description, first define some variables: vi represents the value of the ith ...
Added by yurko on Sat, 12 Feb 2022 08:25:19 +0200
Leetcode algorithm interview sprint practice 15 (binary search tree)
177. Convert the sorted array into a binary search tree with the lowest height
Give a sort array (from small to large) and convert it into a binary search tree with the smallest height.
class Solution:
"""
@param: A: an integer array
@return: A tree node
"""
def sortedArrayToBST(self, A):
# write your code her ...
Added by Kunax on Sat, 12 Feb 2022 07:00:32 +0200
Circuit maintenance double ended queue wide search
Double ended queue wide search is a kind of Dijkstra algorithm, which mainly solves the shortest path problem in which the weight of the edge in the graph is only 0 or 1.
Operation:
Every time you take out elements from the team head and expand other elements
1. If the edge weight of an extended element is 0, the element is inserted into ...
Added by amwd07 on Sat, 12 Feb 2022 04:04:35 +0200
Leetcode backtracking typical questions
LC031. Next Permutation
1, Title
An arrangement of an integer array is to arrange all its members in sequence or linear order.
For example, arr = [1,2,3], the following can be regarded as the arrangement of arr: [1,2,3], [1,3,2], [3,1,2], [2,3,1].
The next permutation of an array of integers refers to the next lexicographically ordered pe ...
Added by tecktalkcm0391 on Sat, 12 Feb 2022 02:26:06 +0200
[Algorithms] Calculate Bob Dylan's lyrics using hash table partitioning
1. Overview
Bob Dylan is a great American poet and songwriter. His creative works contribute a lot to American culture and even to the culture of the whole world. This paper uses NLTK to extract nouns from Bob Dylan's lyrics, stores his lyrics in a hash table for word segmentation statistics, and visualizes the lyrics with high frequency using ...
Added by zimick on Sat, 12 Feb 2022 02:12:22 +0200
Binomial Distribution
definition
Let's take a look at the example of playing cricket. Suppose you win a game today, it means a successful event. You played another game, but you lost. If you win a game today, it doesn't mean you will win tomorrow. Let's assign a random variable x to represent the number of wins. What is the possible value of X? It can be any value, ...
Added by cosmicsea on Sat, 12 Feb 2022 00:28:18 +0200