mirror of
https://gitee.com/apaki/unicstl.git
synced 2025-05-18 03:51:35 +08:00
迭代器:前序遍历right优先测试通过
This commit is contained in:
parent
c8f39bf53a
commit
e6828c2cb0
50
README.md
50
README.md
@ -1,35 +1,35 @@
|
|||||||
# unicstl
|
# unicstl
|
||||||
|
|
||||||
## 简介
|
## 简介
|
||||||
全称: Universal C standard library
|
全称: Universal C standard library
|
||||||
|
|
||||||
基于C语言实现的通用C库。包含常用数据结构和算法
|
基于C语言实现的通用C库。包含常用数据结构和算法
|
||||||
|
|
||||||
> 标准:--std=c99
|
> 标准:--std=c99
|
||||||
|
|
||||||
[数据结构详细说明](http://wenjianfeng.top)
|
[数据结构详细说明](http://wenjianfeng.top)
|
||||||
|
|
||||||
## 数据结构
|
## 数据结构
|
||||||
|数据结构 | 原理 |说明 |
|
|数据结构 | 原理 |说明 |
|
||||||
|---|---|---|
|
|---|---|---|
|
||||||
| **stack** | | **栈** |
|
| **stack** | | **栈** |
|
||||||
| stack_init | 链表 | |
|
| stack_init | 链表 | |
|
||||||
| stack_init2 | 动态数组 | |
|
| stack_init2 | 动态数组 | |
|
||||||
| **list** | | **列表**
|
| **list** | | **列表**
|
||||||
| list_init2 | 动态数组 | |
|
| list_init2 | 动态数组 | |
|
||||||
| **queue** | | **队列**
|
| **queue** | | **队列**
|
||||||
| queue_init | 单向链表 | |
|
| queue_init | 单向链表 | |
|
||||||
| queue_init2 | 数组 | FIFO/空/满 |
|
| queue_init2 | 数组 | FIFO/空/满 |
|
||||||
| **deque** | |**双端队列** |
|
| **deque** | |**双端队列** |
|
||||||
| deque_init | 双向循环链表 | |
|
| deque_init | 双向循环链表 | |
|
||||||
| **tree** | |**树** |
|
| **tree** | |**树** |
|
||||||
| tree_avl_init | 二叉搜索树 | AVL树 |
|
| tree_avl_init | 二叉搜索树 | AVL树 |
|
||||||
| tree_rb_init | 二叉搜索树 | 红黑树 |
|
| tree_rb_init | 二叉搜索树 | 红黑树 |
|
||||||
| **heap** | |**堆** |
|
| **heap** | |**堆** |
|
||||||
| heap_init2 | 数组 | 最大堆/最小堆 |
|
| heap_init2 | 数组 | 最大堆/最小堆 |
|
||||||
|
|
||||||
|
|
||||||
## 版本
|
## 版本
|
||||||
| 版本 | 说明 |
|
| 版本 | 说明 |
|
||||||
|:----:|:----:|
|
|:----:|:----:|
|
||||||
| 0.xx.xx | 测试版本 |
|
| 0.xx.xx | 测试版本 |
|
||||||
|
484
src/tree.c
484
src/tree.c
File diff suppressed because it is too large
Load Diff
@ -558,8 +558,9 @@ static void test_tree_iter(void)
|
|||||||
TEST_ASSERT_EQUAL_INT_ARRAY(expected_int_array[i], buff, count);
|
TEST_ASSERT_EQUAL_INT_ARRAY(expected_int_array[i], buff, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tree->order(tree, true);
|
||||||
printf("\n\nactual data = \n");
|
printf("\n\nactual data = \n");
|
||||||
tree->breadth(tree, tree->_root);
|
tree->preorder(tree, tree->_root);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
// set order
|
// set order
|
||||||
@ -567,7 +568,8 @@ static void test_tree_iter(void)
|
|||||||
// tree->set_order(tree, ORDER_LEFT_IN);
|
// tree->set_order(tree, ORDER_LEFT_IN);
|
||||||
// tree->set_order(tree, ORDER_LEFT_POST);
|
// tree->set_order(tree, ORDER_LEFT_POST);
|
||||||
// tree->set_order(tree, ORDER_LEFT_BREADTH);
|
// tree->set_order(tree, ORDER_LEFT_BREADTH);
|
||||||
tree->set_order(tree, ORDER_RIGHT_BREADTH);
|
tree->set_order(tree, ORDER_RIGHT_PRE);
|
||||||
|
// tree->set_order(tree, ORDER_RIGHT_BREADTH);
|
||||||
printf("\n ----- iter data -----\n");
|
printf("\n ----- iter data -----\n");
|
||||||
for (count = 0, iter = tree->begin(tree); iter != tree->end(tree); iter = tree->next(tree))
|
for (count = 0, iter = tree->begin(tree); iter != tree->end(tree); iter = tree->next(tree))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user