Binary tree special exercise

catalogue I Recursive traversal (1) Middle order traversal (2) Preorder traversal (3) Postorder traversal 2. Iterative method (1) Preorder traversal (2) Postorder traversal (3) Middle order traversal III level traversal 4, 226 Flip binary tree LeetCode (LeetCode CN. Com) 5, 101 Symmetric binary tree LeetCode (LeetCode CN. Com) 1. ...

Added by hackerkts on Thu, 27 Jan 2022 16:10:36 +0200

Set set and source code analysis

1. Basic introduction to set interface Unordered (the order of addition and extraction is inconsistent), and there is no indexDuplicate elements are not allowed, so it can contain at most one null public static void main(String[] args) { HashSet<Object> set = new HashSet<>(); set.add(1); set.add(1); ...

Added by Mikedean on Wed, 26 Jan 2022 20:16:39 +0200

The parity rearrangement of NC133 linked list, the maximum path in NC6 binary tree and NC26 brackets of NC16 symmetric binary tree generate NC18 clockwise rotation matrix

Parity rearrangement of linked list Parity rearrangement of NC133 linked list Use a cnt counter When the node is the odd node, it will be inserted into the odd linked list When the node is the even node, it will be inserted into the even linked list Finally, point the next of the tail pointer of the odd chain to the header node of the ...

Added by PatelNehal on Wed, 26 Jan 2022 09:11:11 +0200

0019 - delete the penultimate node of the linked list

Problem description Give you a linked list, delete the penultimate node of the linked list, and return the head node of the linked list. Advanced: can you try using one scan? Example 1: Input: head = [1,2,3,4,5], n = 2 Output: [1,2,3,5] Example 2: Input: head = [1], n = 1 Output: [] Example 3: Input: head = [1,2], n = 1 Output: [1] ...

Added by Namadoor on Tue, 25 Jan 2022 21:03:40 +0200

[data structure] hand torn single linked list

I hope to communicate with you and learn from each other through my blog. If you have any mistakes, please correct them in the comment area 1, What is a linked list Sequential tables have defects in space utilization, system consumption and insertion elements. Linked list is the most commonly used dynamic storage method, which overcomes t ...

Added by saariko on Tue, 25 Jan 2022 06:02:21 +0200

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

[LeetCode algorithm note Python(PyCharm running)] sword finger Offer 24 Reverse linked list

Write in front Xiaobian found it difficult to understand the detailed process of recursion when brushing questions. His head is like a ball of paste, always with big question marks? We didn't understand the detailed logic until we debugged with PyCharm, so a detailed PyCharm running program is attached for debugging and understanding. Tit ...

Added by pneudralics on Tue, 25 Jan 2022 03:25:57 +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

C linked list Summary - single linked list

Tip: after the article is written, the directory can be generated automatically. Please refer to the help document on the right for how to generate it Article catalog preface1, What is pandas?2, Use steps 1. Import and storage2. Read in datasummary preface Recently, I learned about the single linked list and did some exercises ...

Added by johanafm on Mon, 24 Jan 2022 14:50:22 +0200

Linked list data structure of Leetcode problem solution

Leetcode solution - linked list Leetcode solution - linked list 1. Find the intersection of two linked lists2. Linked list inversion3. Merge two ordered linked lists4. Delete duplicate nodes from the ordered linked list5. Delete the penultimate node of the linked list6. Exchange adjacent nodes in the linked list7. List summation8. Palindr ...

Added by gacon on Sat, 22 Jan 2022 20:16:20 +0200