BasicDataStructures::CircularLinkedList< CircularLinkedListType > Class Template Reference

(Circular) Linked List ADT (Doubly Linked Pointer to Node Style) - More...

#include <LinkedList.h>

List of all members.

Public Member Functions

 CircularLinkedList (const CircularLinkedList &original_copy)
bool operator= (const CircularLinkedList &original_copy)
CircularLinkedListoperator++ ()
CircularLinkedListoperator++ (int)
CircularLinkedListoperator-- ()
CircularLinkedListoperator-- (int)
bool is_in (const CircularLinkedListType &input)
bool find (const CircularLinkedListType &input)
void insert (const CircularLinkedListType &input)
CircularLinkedListType & add (const CircularLinkedListType &input)
void replace (const CircularLinkedListType &input)
void del (void)
unsigned int size (void)
CircularLinkedListType & peek (void)
CircularLinkedListType pop (void)
void clear (void)
void sort (void)
void beginning (void)
void end (void)
void concatenate (const CircularLinkedList &L)

Protected Member Functions

node * find_pointer (const CircularLinkedListType &input)

Protected Attributes

unsigned int list_size
node * root
node * position

Private Member Functions

CircularLinkedList merge (CircularLinkedList L1, CircularLinkedList L2)
CircularLinkedList mergesort (const CircularLinkedList &L)

Classes

struct  node


Detailed Description

template<class CircularLinkedListType>
class BasicDataStructures::CircularLinkedList< CircularLinkedListType >

(Circular) Linked List ADT (Doubly Linked Pointer to Node Style) -

By Kevin Jenkins (http://www.rakkar.org) Initilize with the following command LinkedList<TYPE> OR CircularLinkedList<Type>

Has the following member functions

Note:
1. LinkedList and CircularLinkedList are exactly the same except LinkedList won't let you wrap around the root and lets you jump to two positions relative to the root/ 2. Postfix ++ and -- can be used but simply call the prefix versions.
EXAMPLE:
 LinkedList<int> A;  // Creates a Linked List of integers called A
 CircularLinkedList<int> B;  // Creates a Circular Linked List of 
          // integers called B

 A.insert(20);  // Adds 20 to A.  A: 20 - current is 20
 A.insert(5);  // Adds 5 to A.  A: 5 20 - current is 5
 A.insert(1);  // Adds 1 to A.  A: 1 5 20 - current is 1

 A.is_in(1); // returns true
 A.is_in(200); // returns false
 A.find(5);  // returns true and sets current to 5
 A.peek();  // returns 5
 A.find(1);  // returns true and sets current to 1

 (++A).peek();  // Returns 5
 A.peek(); // Returns 5

 A.replace(10);  // Replaces 5 with 10.
 A.peek();  // Returns 10

 A.beginning();  // Current points to the beginning of the list at 1

 (++A).peek();  // Returns 5
 A.peek();  // Returns 10

 A.del();  // Deletes 10.  Current points to the next element, which is 20
 A.peek();  // Returns 20
 
 A.beginning();  // Current points to the beginning of the list at 1

 (++A).peek();  // Returns 5
 A.peek();  // Returns 20

 A.clear();  // Deletes all nodes in A

 A.insert(5);  // A: 5 - current is 5
 A.insert(6); // A: 6 5 - current is 6
 A.insert(7); // A: 7 6 5 - current is 7

 A.clear();
 B.clear();

 B.add(10);
 B.add(20);
 B.add(30);
 B.add(5);
 B.add(2);
 B.add(25);
 // Sorts the numbers in the list and sets the current pointer to the 
 // first element
 B.sort();  

 // Postfix ++ just calls the prefix version and has no functional 
 // difference.
 B.peek();  // Returns 2
 B++;
 B.peek();  // Returns 5
 B++;
 B.peek();  // Returns 10
 B++;
 B.peek();  // Returns 20
 B++;
 B.peek();  // Returns 25
 B++;
 B.peek();  // Returns 30


The documentation for this class was generated from the following file:
Generated on Fri Apr 7 21:34:25 2006 for RakNet by  doxygen 1.4.6-NO