Created
October 31, 2011 21:10
-
-
Save tchrist/1328966 to your computer and use it in GitHub Desktop.
LL - iterator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Implement a linked list and supporting classes: | |
LinkedList implementing the Iterator interface: http://php.net/manual/en/class.iterator.php | |
class LinkedList | |
Node $root; | |
//additionally, implement the functions below: | |
GetElements(); //returns an array of all elements in the linked list | |
insert($val); //insert a value at the current position in the linked list | |
delete(); //delete the current value in the linked list | |
Node | |
Node $next, $prev; | |
$val; | |
next(); //returns the next node in the list | |
prev(); //returns the previous value in the list | |
All functions should be unit tested using PHPUnit and the code should be provided with a suite of executable tests. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment