Basic data structure - eight sorts

Sorting: the focus of written examination and interview. 1. Algorithm description; 2. Realization; 3. Efficiency analysis (time complexity, space complexity, stability) Difficulty: too many sorting algorithms Stability: for data with the same keyword (the same number), if A is in front of A 'before sorting, the algorithm is stable if A is i ...

Posted by coowboy on Sat, 02 Oct 2021 18:17:52 -0700

Traversal of binary tree (recursion + iteration)

Summarize the four traversal methods of binary tree, using recursion and iteration. The recursive code is relatively simple, and the iterative code is relatively complex. 1, Preorder traversal (here, take the printed results as an example, you can also use ArrayList to store the val in the subtree) thinking Recursion: first the root node ...

Posted by Naug on Sat, 02 Oct 2021 15:00:13 -0700

data_structural (data structure) - reset version

Data type: divided into two categories 1. It is the type of c language itself, also known as built-in type char Character type 1 byte short Short shaping 2 bytes int plastic four bytes long Long shaping 4/8 byte long long Longer shaping 8 bytes float Single-precision floating-poin ...

Posted by ColdFusion on Sat, 02 Oct 2021 10:55:39 -0700

Data structure - stack and queue refinement

preface This paper focuses on the knowledge of data structure stack and queue. Since this paper also designs multiple dynamic memory development functions, before learning this paper, we must firmly grasp the relevant knowledge of dynamic memory development, so that we can get twice the result with half the effort. Tip: the following ...

Posted by razz on Fri, 01 Oct 2021 19:22:43 -0700

Simple introduction to line segment tree

catalogue 1, Introduction to segment tree 1. Import segment tree 2. Common sense of segment tree 2, Operation of segment tree          1. Build a tree 2. Interval query 3. Interval modification 3, Lazy tag 1. The role of lazy markers 2. Code 4, P3372 [template] segment tree 1   Solution to the problem 1, Introduction to segme ...

Posted by Goins on Fri, 01 Oct 2021 16:21:57 -0700

06_JavaScript data structure and algorithm one-way linked list

JavaScript data structure and algorithm (VI) one way linked list Cognitive linked list Linked lists and arrays Like arrays, linked lists can be used to store a series of elements, but the implementation mechanism of linked lists and arrays is completely different. array Storing multiple elements, arrays (or lists) are probably the most co ...

Posted by _will on Fri, 01 Oct 2021 14:48:26 -0700

Acwing - 131. The largest rectangle in the histogram

131. The largest rectangle in the histogram - AcWing question bank Title Description tag: monotone stack A histogram is a polygon consisting of a series of rectangles aligned at a common baseline. Rectangles have equal widths, but can have different heights. For example, the left side of the legend shows a histogram composed of rect ...

Posted by coelex on Fri, 01 Oct 2021 12:02:00 -0700

LRU implementation principle

preface We often use cache to improve data query speed. Due to the limited cache capacity, when the cache capacity reaches the upper limit, we need to delete some data to make room so that new data can be added. Cache data cannot be deleted randomly. Generally, we need to delete cache data according to some algorithm. Common elimination algori ...

Posted by n14charlie on Fri, 01 Oct 2021 11:22:00 -0700

LeetCode 15 sum of three numbers

LeetCode 15 sum of three numbers Title Description Give you an array num containing n integers. Judge whether there are three elements a, b and c in num, so that a + b + c = 0? Please find all triples with sum 0 and no repetition. OJ link Train of thought analysis First, special cases shall be handled If the array is empty, an empty c ...

Posted by zander213 on Thu, 30 Sep 2021 12:18:43 -0700

Double pointer topic summary

(Kago double pointer chapter punch in) 1. Remove element thinking It can be solved directly. But the time complexity will be very large. A simpler way is to speed the pointer. The idea of this fast and slow pointer is that the slow pointer points to the position of the inserted character (treat the array as a new array), and the fast poi ...

Posted by markuatcm on Thu, 30 Sep 2021 11:55:40 -0700