13_JavaScript data structure and algorithm binary search tree

JavaScript data structure and algorithm (XIII) binary search tree Binary search tree Binary Search Tree (BST), also known as binary sort tree and Binary Search Tree. Binary search tree is a binary tree and can be empty. If it is not empty, the following properties are met: Condition 1: all key values of non empty left subtree are less than ...

Posted by bam2550 on Sun, 05 Dec 2021 00:54:35 -0800

Use of completion quantity in linux 3.10

The completion quantity is designed based on the waiting queue, so it is obviously impossible to use the completion quantity in the interrupt context. struct completion { unsigned int done; wait_queue_head_t wait; }; Let's take a classic example of using completion quantity: struct kthread_create_info { /* Information passed to k ...

Posted by jasraj on Sat, 04 Dec 2021 20:18:44 -0800

Chapter 2 sparse arrays and queues

Chapter 2 sparse arrays and queues 2.1 sparse array 2.1.1 basic introduction When most elements in an array are 0 or the same value array, sparse array can be used to save the array (compress redundant data) Representation of sparse array: How many rows and columns are there in the first row? How many different values are there (relati ...

Posted by Mortier on Sat, 04 Dec 2021 19:52:55 -0800

Single linked list (JavaScript Implementation)

To store multiple elements, array is the most commonly used data structure, but array also has many disadvantages: The creation of an array usually requires a continuous memory space, and the size is fixed. Therefore, when the current array cannot meet the capacity requirements, it needs to be expanded (usually apply for a larger array, an ...

Posted by redtux on Sat, 04 Dec 2021 19:39:12 -0800

Queue - simple operation of chain queue and sequential queue

Queue learning notes – chain team and sequence team 1. Queue (circular queue) In the sequential storage structure of the queue, in addition to using a group of storage units with continuous addresses to store the elements from the queue head to the queue tail in turn, it is also necessary to attach two integer variable front and rear to ...

Posted by dragin33 on Sat, 04 Dec 2021 18:46:25 -0800

Data Structure~Base 2~Tree [Design of Binary Tree, Binary Search Tree, AVL Tree, B Tree, Red and Black Tree]~Binary Tree

Data Structure~Base 2~Tree [Design of Binary Tree, Binary Search Tree, AVL Tree, B Tree, Red and Black Tree]~Binary Treehttps://www.cnblogs.com/shan333/p/15492654.html <.    Shape of tree: [Left subtree (left interval)] Root (parent node) [Right subtree (right interval)] Pickle   Why traverse is continuously climbing down th ...

Posted by scifo on Sat, 04 Dec 2021 10:11:29 -0800

Data structure -- C-like language operation supplement

Element type description Sequence table type definition typedef strut { //Define structure ElemType date[]; //Array for storing data elements //ElemType is generic and represents the type of element. It can be changed as needed during actual input //Example: when the data elements are A, B, C and D, the ElemType ...

Posted by ram4nd on Fri, 03 Dec 2021 21:07:49 -0800

Data structure of block

preface Underlying structure of block under Clang analysis Clang, look at the block code int age = 30; void (^yang)(void) = ^{ NSLog(@"%d", age); }; yang(); clang // The existence of isa indicates that block is an object struct __block_impl { void *isa; int Flags; int Reserved; void *FuncPtr; }; struct __main_block_d ...

Posted by Onloac on Fri, 03 Dec 2021 17:35:38 -0800

Graph theory learning notes - linked list and adjacency list

Linked list 1. Preface C/C + + has its own data structure - array, which is easy to use, but it can't insert or delete elements at any position, so we need another data structure to realize this operation, so the linked list was born. The linked list supports insertion or deletion at any position, but can only access the elements in order. We ...

Posted by messels on Fri, 03 Dec 2021 15:17:21 -0800

Data Structure (Java) - High Frequency Interview Questions Related to Map and Set

1. Numbers that occur only once Title Description: Given a non-empty integer array, each element occurs twice, except for one element that occurs only once. Find the element that only appears once. Example 1 Input: [2,2,1] Output: 1 Example 2: Input: [4,1,2,1,2] Output: 4 1. Ideas 1. The easiest way to think about it is to determine ...

Posted by Pig on Fri, 03 Dec 2021 09:21:25 -0800