|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
一个很大的类库。应用程序之所以难以跨平台,在于直接调用了特定平台的接口,而一个巨大的类库,就能极大地减少应用程序对平台的依赖。C#以非递回体例完成三位分列组合,以下代码:- //深度优先classProgram{staticvoidMain(string[]args){int[]number=newint[]{1,3,5,7};Listdata=newList();StackopenStack=newStack();Treeroot=newTree();Treeparent=root;while(true){if(parent.GetDeep()==4){parent.printf();}else{vartempSon=number.ToList();foreach(varitemintempSon){TreeNode=newTree();Node.NodeData=item;Node.Parent=parent;openStack.Push(Node);}}if(openStack.Count==0)break;varitemData=openStack.Pop();parent=itemData;}System.Console.Read();}publicstaticvoidprintf(Listdata){stringd="";data.ForEach(p=>d=d+p);System.Console.WriteLine(d);}}classTree{publicTreeParent;publicintNodeData;publicListSon=newList();publicintGetDeep(){inti=0;varp=this;while(true){if(p==null){returni;}else{p=p.Parent;i++;}}}publicvoidprintf(){stringpf="";varp=this;while(true){if(p==null){System.Console.WriteLine(pf);return;}else{if(p.NodeData!=0){pf=p.NodeData+pf;}p=p.Parent;}}}}//广度优先classProgram{staticvoidMain(string[]args){int[]number=newint[]{1,3};List<int>data=newList<int>();Stack<Tree>openStack=newStack<Tree>();Queue<Tree>openQueue=newQueue<Tree>();Treeroot=newTree();Treeparent=root;while(true){if(parent.GetDeep()==4){parent.printf();}else{vartempSon=number.ToList();foreach(varitemintempSon){TreeNode=newTree();Node.NodeData=item;Node.Parent=parent;//openStack.Push(Node);openQueue.Enqueue(Node);}}if(openQueue.Count==0)//if(openStack.Count==0)break;varitemData=openQueue.Dequeue();//openStack.Pop();parent=itemData;}System.Console.Read();}publicstaticvoidprintf(List<int>data){stringd="";data.ForEach(p=>d=d+p);System.Console.WriteLine(d);}}classTree{publicTreeParent;publicintNodeData;publicList<Tree>Son=newList<Tree>();publicintGetDeep(){inti=0;varp=this;while(true){if(p==null){returni;}else{p=p.Parent;i++;}}}publicvoidprintf(){stringpf="";varp=this;while(true){if(p==null){System.Console.WriteLine(pf);return;}else{if(p.NodeData!=0){pf=p.NodeData+pf;}p=p.Parent;}}}}
复制代码 我以前很喜欢Serv-U,自从它用Java重写之后我就再也没用过,实在是太慢了,我宁可用IIS搭建FTP,虽然IIS搭建FTP在权限管理上很不灵活。 |
|