PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Bas Jobsen   Linked List   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example
Class: Linked List
Linked List
Author: By
Last change: changed for bigfix deleting last element of the list
Date: 20 years ago
Size: 1,049 bytes


Class file image Download
   Example for Linkedlist.php
   copyright 2003 Bas Jobsen (
   Last Change: 20003/02/13

$LIST= new LinkedList();

$ITEM1= new ListItem(5);
$ITEM2= new ListItem(6);
$ITEM3= new ListItem(12);
$ITEM4= new ListItem(1);
$ITEM5= new ListItem(165);
$x=$LIST->ListSearch(1); /* 1) */
$LIST->ListDelete(&$ITEM5); /* 2) */
The procedure ListDelete removes an element form
a linked list. It must give be given a pointer 2)
to x. If you wish to delete an element with a given
key you must first call ListSearch 1) to retrieve
a pointer to the element.
Introduction to ALGORITHMS
Thomas H. Cormen
Charles E. Leiserson
Ronald L. Rivest