数据结构各种算法实现(C++模板)
目 录
1、顺序表 ............................................................................................... 1 Seqlist.h ............................................................................................ 1 Test.cpp ............................................................................................. 7 2、单链表 ............................................................................................... 9 ListNode.h ........................................................................................... 9 SingleList.h ........................................................................................ 11 test.cpp ............................................................................................ 22 3、双向链表 ............................................................................................ 25 NodeList.h .......................................................................................... 25 DoubleList.h ........................................................................................ 27 Test.cpp ............................................................................................ 38 4、循环链表 ............................................................................................ 40
ListNode.h .......................................................................................... 41 CircularList.h ...................................................................................... 42 Test.cpp ............................................................................................ 53 5、顺序栈 .............................................................................................. 56 SeqStack.h .......................................................................................... 56 Test.cpp ............................................................................................ 61 6、链式栈 .............................................................................................. 63 StackNode.h ......................................................................................... 63 LinkStack.h ......................................................................................... 64 Test.cpp ............................................................................................ 68 7、顺序队列 ............................................................................................ 71 SeqQueue.h .......................................................................................... 71 Test.cpp ............................................................................................ 76 8、链式队列 ............................................................................................ 79 QueueNode.h ......................................................................................... 79 LinkQueue.h ......................................................................................... 80 Test.cpp ............................................................................................ 84
9、优先级队列 .......................................................................................... 87 QueueNode.h ......................................................................................... 87 Compare.h ........................................................................................... 88 PriorityQueue.h ..................................................................................... 90 Test.cpp ............................................................................................ 96 10、串 ................................................................................................. 99 MyString.h .......................................................................................... 99 MyString.cpp ....................................................................................... 102 test.cpp ........................................................................................... 114 11、二叉树 ............................................................................................ 117 BinTreeNode.h ...................................................................................... 117 BinaryTree.h ....................................................................................... 126 Test.cpp ........................................................................................... 140 12、线索二叉树 ........................................................................................ 142 ThreadNode.h ....................................................................................... 143 ThreadTree.h ....................................................................................... 144 ThreadInorderIterator.h ............................................................................ 145