An open API service indexing awesome lists of open source software.

https://github.com/thinkphp/linkedlist

Linked List Implementation in MooTools
https://github.com/thinkphp/linkedlist

Last synced: 3 months ago
JSON representation

Linked List Implementation in MooTools

Awesome Lists containing this project

README

          

LinkedList
==========

Linked List implementation in MooTools. A linked list is a set of items where each item is part of a node that also contains a link to a node.
When our primary interest is to go through a collection of items sequentially, one by one, we can organize the items as a linked list:
a basic data structure where each item contains the information that we need to get to the next item. The primary advantage of linked lists
over arrays is that the links provide us with the capability to rearrange the items efficiently. This flexivility is gained at the
expense of quick access to any arbitrary item in the list, because the only way to get to an item in the list is to follow links from the
beginning.

![Screenshot](http://farm8.staticflickr.com/7062/6821387570_d805710a33_b.jpg)

How to use
----------

First you must to include the JS files in the head of your HTML document.

#HEAD

google.load("mootools", "1.4.5");

Then

#js
var mylist = new LinkedList();
mylist.insertAtHead("mootools");
mylist.insertAtHead("jQuery");
mylist.insertAtHead("dojo");
mylist.insertAtHead("extjs");
mylist.insertAtHead("yui");
log(mylist.display())
mylist.reverse();
log(mylist.display())
log(mylist.search(2))
mylist.remove(2);
log(mylist.display())
log(mylist.search(2))

Then

#output:
>yui,extjs,dojo,jQuery,mootools
>mootools,jQuery,dojo,extjs,yui
>dojo
>mootools,jQuery,extjs,yui
>extjs

References:

- http://en.wikipedia.org/wiki/Linked_list#Post_office_box_analogy
- http://www.informit.com/store/product.aspx?isbn=0201350882