Pre-middle and post-order traversal (recursive and non-recursive) and level-order traversal of binary trees Article directory Pre-middle and post-order traversal (recursive and non-recursive) and level-order traversal of binary trees Preface 1. Recursive implementation 1. Preorder traversal 2. In-order traversal 3. Post-order traversal 2. Non-recursive implementation 1. Preorder traversal 2. In-order traversal 3. Postorder traversal 3. Layer […]
Tag: binary
[C language data structure——Binary tree]
Article directory Article directory 1. What is a tree? tree definition tree type tree depth Basic terminology for trees 2. Full binary tree definition Characteristics of a full binary tree 3. Complete binary tree definition Features 4. Properties of binary trees 5. Storage structure of binary tree sequential storage structure chain storage structure 6. Basic […]
One question with three solutions (brute force, binary search algorithm, single pointer): the egg falls
Involving knowledge points Violence, single pointer Collection of binary search algorithms Title You are given k identical eggs and access to a building with n floors from floor 1 to floor n. It is known that there is a floor f, satisfying 0
2258. Escape from the fire (attached: understanding of binary search)
Today’s article was written with my new keyboard. Hey, record it! The following are notes based on the explanation of the Lingcha Mountain Aifu Up Master: In the binary search code, pay attention to the opening and closing of the left and right intervals, which can be divided into closed intervals, left-closed right-open intervals, left-open […]
Data structure – binary tree (2)
Table of Contents 1. Relevant properties of binary trees: 2. Storage structure of binary tree: (1), sequential storage (array) (2) Derived data structure – heap: 1. The concept of heap 2. Classification of heaps: (3) Implementation of heap (sequential storage) 1. Definition of heap: 2. Heap initialization: 3. Heap destruction 4. Heap printing: 5. Insert […]
FreeRTOS binary semaphores and counting semaphores
1. Binary semaphore and counting semaphore binary semaphore concept Queue of length 1 There is no need to care about the storage content, just whether it is empty or not. Application scenarios Synchronization of tasks and tasks, tasks and interrupts block When the task obtains the semaphore, if the semaphore is empty, it enters the […]
235. Lowest Common Ancestor of a Binary Search Tree 701. Insert into a BST 450. Delete Node in a BST
235. Lowest Common Ancestor of a Binary Search Tree Given a binary search tree (BST), find the lowest common ancestor (LCA) node of two given nodes in the BST. According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined between two nodes p and q as the lowest node in T […]
Binary tree (chained structure storage)
Personal business card: About the author: A sophomore student who is willing to share what he has learned on the road of study. Personal homepage: GOTXX Personal WeChat: ILXOXVJEThis article is original by GOTXX and first published on CSDN Column series: Learning C language from scratch —– The road to learning data structuresWord of the […]
Basic data structure – binary tree
1. Tree concept and structure Tree is a non-linear data structure, which is a set of hierarchical relationships composed of n (n>=0) limited nodes. It’s called a tree because it looks like an upside-down tree, which means it has the roots pointing up and the leaves pointing down. There is a special node called the […]
C++ binary algorithm: swimming in a swimming pool with rising water level
Involving knowledge points Binary search Union search or BFS. Title In an n x n integer matrix grid, the value of each square grid[i][j] represents the height of the platform at position (i, j). When it starts to rain, at time t, the water level in the pool is t. You can swim from one […]