.................f .............../ \ .............d....e ............/ \ ...........a...c .................\ ..................b 后序遍历线索树顺序是a b c d e f,a线索b,b线索c,c如何前进到d?
就是那种有一个孩子,一个兄弟的树 struct node { elementtype elem; stuct node *child; stuct node *brother; }; 要用来计算文件大小, 画了个图,不知道怎么传 谢谢
工作中遇到的一个问题,我想了一下,大概有了思路,欢迎讨论,晚上把demo代码给贴出来. 比如一个这样定义的结点. struct Node { struct Node *pLeft, *pRight, *pParent; int nKey; }; [ 本帖最后由 converse 于 2007-11-1 16:00 编辑 ]
#!/usr/bin/awk -F #向空树中插入1000个随机数,然后遍历这棵树。 BEGIN { n = 1000;root = null = -1 for(i = 1;i <= n;i++) root = insert(root,int(n*rand())) traverse(root) exit } function insert(p,x) { if(p == null) { val[p = (++nodecount)] = x lson[p] = rson[p] = null } else if(x < val[p]) { lson[p] = insert(lson[p],x) } else if(x > val[p]) { rson[p] = insert(rson[p],x) } # els...
想生成一个漂亮的树型目录树, 比如: -folder1 ---file11 ---file12 -folder2 ---file21 ---file22 ---folder21 ------file211 尝试着用下面这个, 略过"."或"..", 输出一般文件(&&以前)和目录(&&以后), ls -l -F |grep -v \/ | awk '/^-/ {print}' && ls -l -F |grep \/ |awk '/^d/ {print}' # 能同时输出整行的同时, 再获得最后一列的文件/目录名? 执行结果,没有递归下去 -- 加了 R 结果一下子就乱了. 还试了'find -type...
#!/bin/bash rmcache() { for file in 'find *' do if [-d $file] then cd $file rmcache() fi if [-f $file] then cd .. for file1 in 'find *' do rm -rf $file1 sleep 60 done sleep 60 fi done } rmcache 一个目录,在它下面有非常多的随机生成的目录,在这些随机生成目录下面还是随机生成的目录....... 这些随机目录一共6层或7层,只有在最后一层的随机目录中有文件...
struts标签中的遍历 id是逻辑对象,代表name的对象。type是对象所属的类型。name是在Action中封装的对象字符串。 ${allClass.className} ${allClass.classMaster} ${allClass.isElite} ${allClass.browsePurview} 添加子栏目|修改设置|移动栏目|清空|删除 jstl中的遍历: items在Action中封装的对象字符串。var逻辑对象 ${user.id} ...