Han Shunping _ PHP programmer fun algorithm open course (first season) 02 _ single-chain table in memory exist in the form of analysis _ learning notes _ source code illustration _ PPT document finishing text West Malone: Workshop. Content 1. what is a linked list 2. one-way link Han Shunping _ PHP programmer fun algorithm open class (first season) 02 _ single-chain table in memory exist Form Analysis _ learning notes _ source code illustration _ PPT document sorting
Wen Xi Malone: http://blog.csdn.net/wenximalong/
Linked list-the most flexible data structure
It is convenient to use linked lists to solve complex problems and algorithms.
Content
1. what is a linked list?
2. one-way linked list
3. two-way linked list
4. circular linked list
5. Solve the Joseph problem by using a circular linked list
Linked list-what is a linked list
The linked list is an ordered list, but it is stored discretely in the memory.
Linked lists are everywhere,For example, in an operating system, the link between a file and a file is linked by a linked list.
Using a linked list can solve problems like Joseph, sorting, indexing, binary trees, and generalized tables...
Linked list-quick start to a single-chain table
Use the one-way linked list of the head header to implement hero ranking management
Php is used for implementation. if it is c #/c ++/java,The idea is the same.
Now let's look at what kind of data structure is linked list? -> Memory graph analysis
SingleLink. php
One-Way linked list for hero ranking management
Query heroes add heroes delete heroes modify heroes
No = $ no; $ this-> name = $ name; $ this-> nickname = $ nickname ;}// some students are not familiar with PHP syntax, I will demonstrate // create a hero $ Hero = new hero (1, 'songjiang ', 'timely Rain'); // echo outputs echo $ hero-> name;?>
Memory analysis diagram
The picture is large. open the picture in a new window to view the complete picture.
The underlying layer of PHP is c. when a program runs,Memory is divided into five zones [Stack zone/heap zone/Global Zone/constant zone/code zone]
Once a program is run, how is things distributed in these five zones,Be very clearOtherwise, it will be confused.
C/c ++/java: The same is true for their memory analysis, because this is the underlying thing.
Han Shunping _ PHP programmer fun algorithm open course _ learning notes _ source code illustration _ PPT document arrangement _ Directory