LinkedList introduction and some source code analysis

summary _ LinkedList_ At the same time, it realizes_ List_ Interface and_ Deque_ Interface, that is, it can be regarded as a sequential container, a queue, and a stack Therefore, when you need to use queue or stack structure, you can consider using LinkedList The implementation of LinkedList determines that all operations related to subscripts ...

Added by brmcdani on Tue, 25 Jan 2022 04:52:34 +0200

Segment tree -- interval maximum gcd problem

AcWing 246. Interval maximum common divisor Given A sequence A with length N and M instructions, each instruction may be one of the following two: C l r d means adding d to A[l],A[l+1],..., A[r]. Q l r, represents the maximum common divisor (GCD) of query A[l],A[l+1],..., A[r]. For each query, an integer is output to represent the answer. Inp ...

Added by brad_fears on Tue, 25 Jan 2022 04:50:31 +0200

Brush questions every day Day14

Question 1: expand the binary tree into a linked list Here is the root node of the binary tree. Please expand it into a single linked list: The expanded single linked list should also use TreeNode, where the right sub pointer points to the next node in the linked list, and the left sub pointer is always null. The expanded single linked list sho ...

Added by ZHarvey on Tue, 25 Jan 2022 00:56:31 +0200

Python Data Structure Advancement

In almost every Python basic tutorial, built-in data structures such as list,set,dict are mentioned. Python also has some advanced data structures, most of which are stored in collections libraries, in addition to There is also array. Data structures such as array. You can compare them to STL s in C++. These advanced data structures are also w ...

Added by squiblo on Mon, 24 Jan 2022 21:23:36 +0200

Love and hate between callback function and qsort function

catalogue 1, Simple bubble sort 1.1 meaning of bubble sorting 1.2 bubble sorting two steps 1.3 complete code 2, qsort function implementation 2.1qsort function analysis 2.2qsort function to sort structure types 2.3 implementation of qsort by user-defined functions Third, callback function 1, Simple bubble sort 1.1 meaning of bubbl ...

Added by FFFF on Mon, 24 Jan 2022 19:45:11 +0200

Balanced Binary Tree*

         balanced binary tree Balanced Binary Tree is also known as AVL tree. _Definition: An AVL tree is a binary lookup tree in which the balance factor for each node (defined as the height difference between the left and right subtrees of the node) is either zero or +1 or -1 (the height of an empty tree is defined as -1, although the ...

Added by han2754 on Mon, 24 Jan 2022 11:37:01 +0200

AcWing basic algorithm

AcWing basic algorithm (I) Quick sort subject Give you a sequence of integers with length nn. Please use quick sort to sort this sequence from small to large. And output the ordered sequence in order. Input format The input consists of two lines. The first line contains the integer nn. The second row contains nn integers (all integers a ...

Added by yaba on Sun, 23 Jan 2022 23:41:46 +0200

Kiner algorithm: hash table and bloom filter (hand tearing algorithm)

Guide to series of articles Guide to series of articles Open source project All articles in this series will be included in GitHub for unified collection and management. Welcome ISSUE and Star. GitHub portal: Kiner algorithm preface After understanding the underlying implementation principle of hash table, the design of hash function, the ...

Added by irishprogrammin on Sun, 23 Jan 2022 17:17:54 +0200

Data structure Li Chao line segment tree

title: "data structure" Li Chao line segment tree date: 2022-01-22 10:38:01 tags: c++ data structure categories: data structure mathjax: true description: a brief explanation of Li Chao's line segment tree #0.0 chip in front Li Chao's line segment tree is built by Li Chao, the team master of Xuejun middle school Provincial lectures ...

Added by premracer on Sun, 23 Jan 2022 11:23:50 +0200

[CF1626E]Black and White Tree

subject Title Link: https://codeforces.com/contest/1626/problem/E A tree with \ (n \) nodes. The nodes have black and white colors, and the number of black spots is at least \ (2 \). At the beginning, there is a stone at a certain point in the tree. You can select a black point for each operation and let the stone go one side in the direction o ...

Added by cold on Sun, 23 Jan 2022 10:30:00 +0200