GNU   davin.50webs.com/research
Bringing to you notes for the ages

       Main Menu          Research Projects         Photo Album            Curriculum Vitae      The Greatest Artists
    Email Address       Computer Games          Web Design          Java Training Wheels      The Fly (A Story)   
  Political Activism   Scruff the Cat       My Life Story          Smoking Cessation          Other Links      
Debugging Macros     String Class I     Linked List System I Java for C Programmers Naming Convention
    String Class II         How I use m4              Strings III                 Symmetrical I/O             Linked Lists II     
Run-Time Type Info   Virtual Methods      An Array System        Science & Religion            Submodes       
  Nested Packages      Memory Leaks    Garbage Collection      Internet & Poverty      What is Knowledge?
Limits of Evolution   Emacs Additions      Function Plotter           Romantic Love        The Next Big Thing
    Science Fiction     Faster Compilation Theory of Morality         Elisp Scoping               Elisp Advice      
  S.O.G.M. Pattern       Safe Properties         School Bullying          Charisma Control          Life and Death    
     Splitting Java          Multiple Ctors       Religious Beliefs         Conversation 1           Conversation 2    
   J.T.W. Language    Emacs Additions II      Build Counter             Relation Plotter          Lisp++ Language  
  Memory Leaks II   Super Constructors CRUD Implementation Order a Website Form There Is An Afterlife
More Occam's Razor C to Java Translator Theory of Morality II


class List<X>

public:

List constructor.  Constructs an empty list in O(1) time.
                         List()

List destructor.  Internally calls delete_shallow. Destructor
is virtual in case someone decides to inherit from the List<X> class.
Takes O(n) time.
   virtual               ~List();

Calls operator delete on all private_data and node pointers.
The result is an empty list.  Takes O(n) time.
   void                  delete_deep();
Calls operator delete on all node pointers.
The result is an empty list.  Take O(n) time.
   void                  delete_shallow();

Returns a pointer to the start of the list.  Takes O(1) time.
   Node<X>*              get_first();
Returns a pointer to the end of the list.  Takes O(1) time.
   Node<X>*              get_last();

Const versions of the previous two methods. Each method takes O(1) time.
   const Node<X>*        get_first_const() const;
   const Node<X>*        get_last_const() const;

Chains x onto the start of the list.  Takes O(1) time.
   void                  add_to_start(X* x);
Chains x onto the end of the list.  Takes O(1) time.
   void                  add_to_end(X* x);

Returns the length of the list.  Takes O(1) time.
   int                   get_length() const;
Returns whether or not the list has been changed since construction
or the last call to clear_dirty(). Takes O(1) time.
   bool                  get_dirty() const;
Allows the client to declare the list as unchanged. Takes O(1) time.
   void                  clear_dirty();

Reverses the order of the list.  Takes O(n) time.
   void                  reverse();


Non-essential methods:

Abbreviation for: add_to_end(x). Takes O(1) time.
   void                  add_element(X* x);

Adds all the elements of argument "list" onto the end of the
current List.  Takes O(list->get_length()) time.
   void                  add_list(List<X>* list);

Eliminates get_data() in client code. Each method takes O(1) time.
   void                  add_element(Node<X>* node);
   void                  add_to_start(Node<X>* node);
   void                  add_to_end(Node<X>* node);


private:

Pointer to the start of the list.
   Node<X>*              private_first;

Pointer to the end of the list.
   Node<X>*              private_last;

Stores the length of the list.
  int                    private_length;

Holds a value if and only if the list has been altered
since the list's construction or the last call to clear_dirty()
  bool                   private_dirty;

Disallow passing and returning by value.
                   List(const List& l);
  List&            operator = (const List& l);


Back to Linked List System II
| Main Menu | Research Projects | Photo Album | Curriculum Vitae | The Greatest Artists |
| Email Address | Computer Games | Web Design | Java Training Wheels | The Fly (A Story) |
| Political Activism | Scruff the Cat | My Life Story | Smoking Cessation | Other Links |
| Debugging Macros | String Class I | Linked List System I | Java for C Programmers | Naming Convention |
| String Class II | How I use m4 | Strings III | Symmetrical I/O | Linked Lists II |
| Run-Time Type Info | Virtual Methods | An Array System | Science & Religion | Submodes |
| Nested Packages | Memory Leaks | Garbage Collection | Internet & Poverty | What is Knowledge? |
| Limits of Evolution | Emacs Additions | Function Plotter | Romantic Love | The Next Big Thing |
| Science Fiction | Faster Compilation | Theory of Morality | Elisp Scoping | Elisp Advice |
| S.O.G.M. Pattern | Safe Properties | School Bullying | Charisma Control | Life and Death |
| Splitting Java | Multiple Ctors | Religious Beliefs | Conversation 1 | Conversation 2 |
| J.T.W. Language | Emacs Additions II | Build Counter | Relation Plotter | Lisp++ Language |
| Memory Leaks II | Super Constructors | CRUD Implementation | Order a Website Form | There Is An Afterlife |
| More Occam's Razor | C to Java Translator | Theory of Morality II
Last modified: Sun Sep 25 16:11:42 NZDT 2016
Best viewed at 800x600 or above resolution.
© Copyright 1999-2016 Davin Pearson.
Please report any broken links to