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
- Host: GitHub
- URL: https://github.com/thinkphp/linkedlist
- Owner: thinkphp
- Created: 2012-03-09T20:35:17.000Z (almost 14 years ago)
- Default Branch: master
- Last Pushed: 2012-03-14T17:58:51.000Z (almost 14 years ago)
- Last Synced: 2024-04-14T14:54:26.644Z (almost 2 years ago)
- Language: JavaScript
- Homepage: http://thinkphp.github.com/LinkedList/
- Size: 109 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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.

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