Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Implement linked list in php

Tags:

How should I implement a linked list in PHP? Is there a implementation built in into PHP?

I need to do a lot of insert and delete operations, and at same time I need to preserve order.

I'd like to use only PHP without any special extensions.

like image 316
osgx Avatar asked Sep 02 '10 20:09

osgx


People also ask

What is linked list and its implementation?

Like arrays, Linked List is a linear data structure. Unlike arrays, linked list elements are not stored at a contiguous location; the elements are linked using pointers. They include a series of connected nodes. Here, each node stores the data and the address of the next node.

Can we implement linked list using queue?

Queue supports operations like enqueue and dequeue. It can be implemented using an array and linked list.

Does linked list implement list?

Java LinkedList Class Diagram As we know, Java LinkedList is one the List implementation class. It also implements Deque. As shown in class diagram below, it does NOT extends directly from AbstractList class. It extends AbstractSequentialList class.


1 Answers

There is SplDoublyLinkedList. Is this okay, too?

like image 109
NikiC Avatar answered Oct 17 '22 01:10

NikiC