Tag：linked list

Time：20211024
A go language implementation of unidirectional linked list package main import “fmt” type Node struct { no int name string next *Node } //Insert a node into the linked list at the end of the implementation (an implementation of queue push) func InsertTail(head *Node, newNode *Node){ //First find the last node of the linked list. […]

Time：20211023
A go language implementation of bidirectional linked list package main import “fmt” //Define node information type dNode struct { id int name string pre *dNode next *dNode } //Tail insert node func dInsertTail(head, newNode *dNode) { //Define a temporary walk variable temp := head for { if temp.next == nil{ Break // after walking to […]

Time：20211022
A simple implementation of a linked list of queues package main import “fmt” type Queue struct { id int name string next *Queue } //Push func Push(head, node *Queue){ node.next = head.next head.next = node } //Pop func Pop(head *Queue) (node *Queue){ temp := head for { if temp.next == nil{ return }else if temp.next.next […]

Time：20211021
Follow all textbooks and books related to various data structures. Let’s start with linear tables. Today’s article is more conceptual, which is a summary of a knowledge point with a linear table. As mentioned above, physical structure is used to determine how data is stored. Other data structures (trees, graphs) and algorithms are basically based […]

Time：20211021
A go language implementation of ring linked list package main import “fmt” //Defines the node structure of a ring linked list type circleSingleLink struct { id int name string next *circleSingleLink } //Insert node into ring linked list func Insert(head, newnode *circleSingleLink) { //Determine whether it is an empty linked list if head.next == nil{ […]

Time：20211021
preface A skip list is an ordered data structureOrdered linked listIt solves the efficiency problem of finding a value in the ordered linked list. Jump table supports averageO(logn)In most cases, the efficiency of node search with the worst o (n) complexity is comparable to that of balanced tree, and the implementation is simpler. Redis uses […]

Time：20211020
preface High frequency use in daily workHashMapThis data structure, and I also encountered relevant interview questions in the last job search process. Tonight, learn about the internal design of the data structure by reading the source code. JDK version 1.8.0_ two hundred and thirtyone text Inheritance relationship HashMap inheritsAbstractMapClass, which implementsMap Cloneable SerializableInterface. MapThe interface […]

Time：20211020
The operation of linked list is much more complex than that of sequential list (array). Because PHP has indeed solved many array operation problems for us, we can easily operate arrays without defining many logical operations for arrays. For example, in C, arrays are limited in length, which we won’t consider in PHP. If you […]

Time：20211019
In the last article, we have said that the linked list has several other forms besides the simple oneway linked list. Of course, this is also a major feature of the linked list structure, which is very flexible and convenient. Let’s simply think about it. If the next of the last node refers back to […]

Time：20211016
A go language implementation of hash table package main import ( “fmt” “os” ) //Information of data in linked list type Emp struct { Id int Name string Next *Emp } func (e *Emp) ShowSelf() { FMT. Printf (“linked list% d found this node% d \ n”, e.id% 7, e.id “) } //Define a linked […]

Time：20211013
//Each linked list node uses a listnode structure to represent a typedef struct listnode{ //Front node struct ListNode *prev; //Post node struct ListNode *next; //Node value void *value; } ListNode; // typedef struct List{ //Head node struct ListNode *head; //Tail node struct ListNode *tail; //Number of nodes contained in the linked list unsigned long […]

Time：20211011
The concept of figure is almost introduced. You can digest it and continue to learn the following content. If there is no problem, we will continue to learn the next content. Of course, this is not the most troublesome place, because today we just introduce the storage structure of graphs. Sequential storage structure of graphs: […]