Main Page   Modules   Alphabetical List   Data Structures   File List   Data Fields   Globals  

LinkedLists.h

Go to the documentation of this file.
00001 #ifndef __BENAD_LINKED_LISTS__
00002 #define __BENAD_LINKED_LISTS__
00003 
00031 #ifndef __MACTYPES__
00032 
00033 typedef unsigned  char  UInt8;
00034 typedef signed    char  SInt8;
00035 typedef unsigned  short UInt16;
00036 typedef signed    short SInt16;
00037 typedef unsigned  long  UInt32;
00038 typedef signed    long  SInt32;
00039 
00040 #endif /* #ifndef __MACTYPES__ */
00041 
00043 
00046 typedef struct Node
00047 {
00048   struct Node* next;
00049 } Node, *NodePtr;
00050 
00052 
00055 typedef struct IndirectNode
00056 {
00057   Node nodeHeader;
00058   NodePtr nodePtr;
00059 } IndirectNode, *IndirectNodePtr;
00060 
00062 
00065 typedef struct DoubleNode
00066 {
00067   struct DoubleNode* next;
00068   struct DoubleNode* prev;
00069 } DoubleNode, *DoubleNodePtr;
00070 
00072 
00075 typedef struct BinaryNode
00076 {
00077   struct BinaryNode* right;
00078   struct BinaryNode* left;
00079 } BinaryNode, *BinaryNodePtr;
00080 
00081 UInt32 DestroyLinkedList(NodePtr linkedList, UInt8 (*DestructorFunction)(NodePtr theNode));
00082 UInt32 FindLast(NodePtr linkedList, NodePtr* last);
00084 
00087 #define NbrNodes(linkedList) FindLast(linkedList, NULL)
00088 NodePtr GetNthNode(NodePtr linkedList, UInt32 n);
00089 NodePtr SplitAtNth(NodePtr linkedList, UInt32 n);
00090 IndirectNodePtr FindAndList(NodePtr linkedList, UInt8 (*IsWhatIWant)(NodePtr theNode));
00091 NodePtr FindAndMoveOut(NodePtr *linkedListPtr, UInt8 (*IsWhatIWant)(NodePtr theNode));
00092 void ApplyIndirectOnSimple(IndirectNodePtr indirectList);
00093 void InvertList(NodePtr *linkedListPtr);
00094 void SplitAndMergeSort(NodePtr *linkedList, SInt8 (*CompareFuntion)(NodePtr a, NodePtr b));
00095 
00096 void InvertDoubleList(DoubleNodePtr *doubleLinkedListPtr);
00097 UInt32 FindFirst(DoubleNodePtr linkedList, DoubleNodePtr* first);
00098 void FillPrev(DoubleNodePtr linkedList);
00099 
00100 void InsertInTree(BinaryNodePtr theNode, BinaryNodePtr *root,
00101       SInt8 (*CompareFunction)(NodePtr a, NodePtr b));
00102 BinaryNodePtr SortedDoubleToBinaryWithSize(DoubleNodePtr linkedList, UInt32 size);
00104 
00108 #define SortedDoubleToBinary(l) SortedDoubleToBinaryWithSize(l, NbrNodes((NodePtr)(l)));
00109 DoubleNodePtr BinaryToDouble(BinaryNodePtr root, UInt8 fillPrev);
00110 IndirectNodePtr* LeftNodeRight(BinaryNodePtr node, IndirectNodePtr *theList);
00111 void BalanceTree(BinaryNodePtr *root);
00112 
00113 UInt8 DestroyIndirectNode(NodePtr theNode);
00114 
00115 #endif /* #ifndef __BENAD_LINKED_LISTS__ */
00116 

Generated on Sun Dec 23 15:20:37 2001 for ANet by doxygen 1.2.12 written by Dimitri van Heesch, © 1997-2001

SourceForge
Logo