Tag:linked list

  • Data structure — one-way linked list


    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. […]

  • Data structure — bidirectional linked list


    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 […]

  • Data structure — queue (linked list implementation)


    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 […]

  • [PHP data structure] linear table? Sequence table? Linked list? Don’t be silly and confused


    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 […]

  • Data structure — circular linked list


    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{ […]

  • Redis source code – jump table


    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 […]

  • Source code analysis – HashMap


    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 thirty-one text Inheritance relationship HashMap inheritsAbstractMapClass, which implementsMap Cloneable SerializableInterface. MapThe interface […]

  • [PHP data structure] related logical operations of linked list


    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 […]

  • [PHP data structure] other forms of linked list


    In the last article, we have said that the linked list has several other forms besides the simple one-way 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 […]

  • Data structure — hash table


    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 […]

  • Redis linked list implementation


    //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 […]

  • Storage structure of [PHP data structure] diagram


    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: […]