Single linked list
Little prince single linked list
One day, the little prince was fascinated by the game of queuing. There were 10 toys numbered 1-10 placed in order on the table. Now the little prince wants to place them according to his preferences. The little prince selects a beautiful toy from among them and puts it in the front of all t ...
Posted by kannu on Wed, 09 Mar 2022 14:19:21 +0100
1 linked list structure
The sequence table has the following disadvantages:
When inserting or deleting nodes, it is often necessary to move a large amount of dataIf the table is large, it is sometimes difficult to allocate enough memory space, which may lead to memory allocation failure and unable to store
In order to overcome the shortcomin ...
Posted by shafiq2626 on Tue, 08 Mar 2022 20:21:09 +0100
For the implementation of parallel query set based on basic data type, please refer to QuickUnion.
The underlying implementation of user-defined object and query set: linked list + Map mapping [the linked list here is represented as a tree] Logically: multiple trees from bottom to top.
The array can no longer meet the requirements of user-de ...
Posted by kristian_gl on Tue, 08 Mar 2022 18:42:34 +0100
Video address: https://www.bilibili.com/video/BV1eg411g7c8 Relevant source code: https://github.com/anonymousGiga/Rust-and-Web-Assembly
In this section, we will use WebAssembly to implement a simple game.
1 rules of the game
In a two-dimensional grid, the state of each grid is "life" or "death". Each squar ...
Posted by Ansel_Tk1 on Tue, 08 Mar 2022 02:44:23 +0100
We know that in HashMap, the location of a key value pair stored in the internal data of HashMap is related to the hashCode value of K, which is also because the hash algorithm of HashMap is based on the hashCode value.
Three concepts should be distinguished here: hashCode value, hash value, hash method and array subscript
Posted by kidintraffic on Mon, 07 Mar 2022 22:59:18 +0100
Reverse linked list
There are two methods to reverse the linked list: iterative method and recursive method.
There are two ideas. One is to move the next node of the head node to the first one at a time until the head node becomes the last one; The second is to move the first node to the back of the tail node in turn until t ...
Posted by Chas267 on Sun, 06 Mar 2022 16:21:09 +0100
Definition of linear table:
A finite sequence consisting of n(n ≥ 0) data elements (a1,a2,..., an).Record as: L=(a1,a2,..., an) ai-1 is the direct precursor of ai, and ai+1 is the direct successor of ai a1 - first element - it has no precursor an -- tail element - it has no successorTable length: the number of elements in a li ...
Posted by Bobulous on Sat, 05 Mar 2022 01:22:48 +0100
Given a linked list of length n, each node contains an additional random pointer random, which can point to any node or empty node in the linked list.Construct a deep copy of this linked list. The deep copy should consist of exactly n new nodes, in which the value of each new node is set to the value of its corresponding orig ...
Posted by rhodesa on Thu, 03 Mar 2022 15:06:28 +0100
Here are the head nodes headA and headB of the two single linked lists. Please find and return the starting node where the two single linked lists intersect. If there is no intersecting node between the two linked lists, null is returned.
As shown in the figure, two linked lists intersect at node c1:
The title data ensures that ...
Posted by jesbin on Tue, 01 Mar 2022 14:21:24 +0100