Sword finger offer (C + +) -- linked list collection

This series of notes is for self-study algorithm. It only records the problem solving code and some problem solving ideas. All topics are copyrighted by LeeCode and sword finger offer; We recommend a great series of blog for brushing questions and taking notes, which can be used as a reference for the classification of questions in this series: ...

Posted by vcarter on Sun, 23 Jan 2022 07:00:44 +0100

[algorithm] find the lowest common ancestor node of the two nodes of the binary tree

Zuo Cheng cloud algorithm and data structure course https://www.bilibili.com/video/BV13g41157hK?p=2&spm_id_from=pageDriver subject Given the nodes node1 and node2 of two binary trees, find their lowest common ancestor node. Problem solution Solution I Set a HashMap to save the node and its parent node (set the parent node of the root node ...

Posted by willchoong on Sun, 23 Jan 2022 06:53:15 +0100

Introduction to java Foundation Day 6

Array simple basic algorithm 1. Creation of array and element assignment (if you know, there may be) Yang Hui triangle (two-dimensional array), loop number (binary array), 6 numbers, randomly generated between 1-30 and not repeated 2. For numeric arrays Maximum, minimum, sum, average, etc /*Find the maximum, minimum, average, sum, etc. of ...

Posted by wdseelig on Sun, 23 Jan 2022 06:31:03 +0100

Insert sorting algorithm summary -- with JAVA language implementation

Before introducing the algorithm, I will first introduce you to a very useful website. The visualization process inside can help you better understand the data structure and algorithm VISUALGO.NET: https://visualgo.net/zh. Visualization process: The following contents are explained in three aspects: the idea, characteristics and implemen ...

Posted by technotool on Sun, 23 Jan 2022 05:45:24 +0100

(2022.1.19) training: 2021 ICPC Shanghai railway station

Overall summary This time, it's still in a hurry. One important reason is to prepare for the final exam. I haven't been in touch with the game for a long time. On the whole, we should be familiar with the process and skills of doing questions as soon as possible. Of course, it is more important to improve our ability. Topic D The descrip ...

Posted by adavis on Sun, 23 Jan 2022 05:34:35 +0100

python algorithm template part I (quick sort, merge sort, integer bisection, real bisection)

Note: This article is after learning acwing Basic algorithm Course It is mainly used to record the template of python version algorithm. 1. Quick sort Thought: Divide the list with a number (pivot) in the list. The number on the left is less than pivot and the number on the right is greater than pivot. Steps: 1. Determine pivot. Left, right, ...

Posted by TheKiller on Sun, 23 Jan 2022 01:58:25 +0100

Logu p1518[USACO2.4] Two Tamworth Two

Title Description Two cattle escaped into the forest. Farmer John began chasing the two cattle with his expertise. Your task is to simulate their behavior (Bull and John). Follow at 10\times 1010 × 10. In a flat grid. A grid can be an obstacle, two cows (they're all together), or Farmer John. Both cows and Farmer John can be in the same ...

Posted by Derokorian on Sat, 22 Jan 2022 23:46:31 +0100

Thoroughly understand Kruskal algorithm (with C + + code implementation)

I problem The six vertices in the figure represent six villages respectively, and the weight of the line segment represents the distance between villages. How can I find the shortest way to visit each village, and each village can only be visited once. II solve 1. Extract the edges of the graph, arrange the edges from small to large accord ...

Posted by Porl123 on Sat, 22 Jan 2022 22:09:12 +0100

NOJ-Python programming assignment of Northwest University of technology 91-100

Northwest University of technology NOJ-Python programming problem set: Noj Python Programming: Season 1: season 1-easy (1-10) Noj Python Programming: Season 2: Season 2 snippet (11-20) Noj Python Programming: Season 3: season 3-loop (21-30) NOJ-Python programming: Season 4: enumeration algorithm (31-40) NOJ-Python programming: Season 5: modular ...

Posted by luke_barnes on Sat, 22 Jan 2022 21:44:30 +0100

Leetcode Brush Title Notes - Basic Operation and Classic Title of Chain List

Brush the title from: Code Casual Recording 1. Chain list basic operations 707. Design Chain List Leetcode Link Design the implementation of the chain table. You can choose to use single or double-linked lists. A node in a single-chain table should have two attributes: val and next. val is the value of the current node, and next is the ...

Posted by qrt123 on Sat, 22 Jan 2022 21:35:16 +0100