Linked Lists explained in PHP

Click for: original source

As one of the most common data structures, the linked list has to be one of the simplest in concept; yet still very powerful. In this post we will be looking at what linked lists are; what types of linked lists there are; when to use a linked list; and whether or why a linked list might be better than an array. By Doeke Norg.

A linked list is a data structure; a way of organizing data that can be used in a particular way. In its most basic form a linked list is a single node that holds a value, as well as an (optional) reference to another single node.

The article main parts are:

  • What are Linked lists?
  • Types of lists
  • Strengths of (singly) linked lists
  • Weaknesses of (singly) linked lists
  • Circular linked lists
  • When to use linked lists

A Singly Linked List is the most basic linked list. With this type every node has a single pointer to the next node. This makes it uni-directional, as you can only traverse from the head to the last node.

The goal of this post is to introduce the linked list as a data structure. I think it is useful for any programmer to know and recognize these basic data structures. Because by recognizing it in code, it can help you optimize your code; making it faster, and more readable. Excellent read!

[Read More]

Tags php web-development learning app-development programming