随笔分类 -  Algorithm

算法(Algorithm)。
算法:阶乘的五种算法
摘要:背景周末温习了一下递归相关的一些概念,本文先给出阶乘的五种算法。第一种实现:递归 1 private static long RecursiveFac(long n) 2 { 3 if (n == 0) 4 { 5 return 1; 6 } 7 else 8 { 9 return n * RecursiveFac(n - 1);10 }11 ... 阅读全文

posted @ 2013-12-02 17:50 幸福框架 阅读(28953) 评论(7) 推荐(2) 编辑

算法:递归知识文章汇总
摘要:Replacing Recursion With a Stack。How to replace recursive functions using stack and while-loop to avoid the stack-overflow。HOW TO CONVERT A RECURSIVE ALGORITHM TO A NON-RECURSIVE ONE。Replace Recursion with Iteration。Provide an explanation of recursion, including an example。Tail Recursion。Understandi 阅读全文

posted @ 2013-12-01 14:48 幸福框架 阅读(243) 评论(0) 推荐(0) 编辑

算法:插入排序(Insertion Sort)
摘要:1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.Threading.Tasks; 6 7 namespace DataStuctureStudy.Sorts 8 { 9 /// 10 /// 将数组分为两部分:已排序部分和未排序部分,对数组执行一次遍历,将遍历中的11 /// 当前元素插入到已排序的部分。12 /// 初始状态已排序部分只包括一个元素。13 /// 14 cl... 阅读全文

posted @ 2013-11-30 14:25 幸福框架 阅读(406) 评论(0) 推荐(0) 编辑

算法:Rate of Growth
摘要:Rate of growth describes how an algorithm’s complexity changes as the input size grows. This is commonly represented using Big-O notation. Big-O notation uses a capital O (“order”) and a formula that expresses the complexity of the algorithm. The formula may have a variable, n, which represents the 阅读全文

posted @ 2013-11-28 17:30 幸福框架 阅读(2039) 评论(0) 推荐(0) 编辑

算法:“森林的遍历” 在 “企业应用” 的常见场景
摘要:森林的两种遍历方法前序(先根)遍历森林找到森林中的所有的根结点。前序遍历森林中的每个根节点对应的树。后序(后根)遍历森林找到森林中的所有的根结点。后序遍历森林中的每个根节点对应的树。树的两种遍历方法前序(先根)遍历树访问树的根结点。找到根节点的所有子节点。前序遍历每个子节点。后序(后根)遍历树找到根节点的所有子节点。后续序遍历每个子节点。访问树的根结点。企业应用场景 之 前序遍历效果图代码示例 1 /// <reference path="Ext/ext-all-debug-w-comments.js" /> 2 3 function arrayToTree(a 阅读全文

posted @ 2013-04-27 07:29 幸福框架 阅读(2105) 评论(11) 推荐(1) 编辑

导航

我要啦免费统计