[XJTUSE] data structure learning - 3.3 Huffman tree

3.3 Huffman tree Basic concepts Path length: the number of branches on the path between two nodes External path length of the tree: the sum of the path length from each leaf node to the root node Internal path length of the tree: the sum of the path length from each non leaf node to the root node Weighted path length of tree: the sum o ...

Posted by amorphous on Fri, 04 Feb 2022 12:40:55 +0100

Leetcode algorithm interview sprint actual combat 12 (stack)

978 · basic calculator Implement a basic calculator to calculate a simple expression. The expression string may contain left parenthesis' ('and right parenthesis'), plus sign' + 'or minus sign' - ', non negative integer and space'. The expression given is always reasonable. Learned the usage of eval. An error was encountered: E ...

Posted by w00kie on Fri, 04 Feb 2022 12:25:21 +0100

Mathematical modeling 2020B problem crossing the desert

1. Title Consider the following small games: players use a map, use the initial funds to buy a certain amount of water and food (including food and other daily necessities), start from the starting point and walk in the desert. In case of different weather on the way, you can also supplement funds or resources in mines and villages. The goal i ...

Posted by oskom on Fri, 04 Feb 2022 10:30:00 +0100

Community discovery algorithm -- LPA and SLPA algorithm

LPA(Label Propagation Algorithm) LPA algorithm was proposed by zhu et al in 2002. In 2007, it was applied to the field of community discovery by Usha, Nandini and Raghavan, and RAK algorithm was proposed. But most researchers call RAK algorithm LPA algorithm. LPA is a local community division based on Label Propagation. For each node in the n ...

Posted by raw100 on Fri, 04 Feb 2022 10:04:57 +0100

String DP summary

preface: Most question types of string DP use the minimum or maximum number of operation steps to change the original string into a new string. Therefore, most of them use interval DP to solve, and some of them will be optimized by interval DP. Below are some common question types. 1, Palindrome string multi-dimensional deformation 1. Fi ...

Posted by Fredric on Fri, 04 Feb 2022 09:37:42 +0100

Self study JAVA notes 03

Scanner There are two ways to receive strings: next and nextLine public class Demo01 { public static void main(String[] args) { //Create a scanner object to receive keyboard data Scanner scanner0 = new Scanner(System.in); System.out.println("use next Reception mode:"); //Judge whether the user has entered a ...

Posted by jeremuck on Fri, 04 Feb 2022 08:58:57 +0100

Algorithm self-study notes: binary search tree search operation

In this paper, we continue to build a binary tree, and the rest of the methods API: size() returns the total number of nodes select(int k) returns the key ranked K in the tree, that is, K keys are less than it Rank (key) returns the ranking of a given key, that is, the number less than the key in the tree To implement these methods, we ...

Posted by magie on Fri, 04 Feb 2022 08:56:12 +0100

[C + +] binary search tree

Today we will talk about a special binary tree, binary search tree. Learning binary search tree well will help us understand and master map and set later. Binary search tree concept Binary search tree, also known as binary sort tree, is either an empty tree or a binary tree with the following properties: If its left subtree is not empty, ...

Posted by bigshwa05 on Fri, 04 Feb 2022 08:31:05 +0100

Data structure -- Huffman tree and its application

Basic concepts of Huffman   Path: the branch from one node to another in the tree forms the path between the two nodes Node path length: the number of branches on the path between two nodes   Path length of tree: the sum of the path length from the tree root to each node is recorded as TL In the binary tree with the same number of n ...

Posted by amarquis on Fri, 04 Feb 2022 06:17:58 +0100

Algorithm design and analysis tree dp

summary Premise of use: if the goal of problem solving is rule S, the solving process can be determined as each answer of the subtree with each node as the head node under rule S, and the final answer must be in itRoutine steps: (1) In the subtree with a node x as the head node, analyze the possibilities (difficulties) of the answer, and t ...

Posted by ramma03 on Fri, 04 Feb 2022 06:12:49 +0100