随笔分类 - Algorithms
摘要:单链表 class Program { static void Main(string[] args) { LinkedList<int> linkedList = new LinkedList<int>(); Node<int> node1 = new Node<int> { Data = 1 }
阅读全文
摘要:递归 static int GetValue(int n) { if (n <= 0) return 0; if (n == 1 || n == 2) return 1; else return GetValue(n - 1) + GetValue(n - 2); } 迭代 static int G
阅读全文
摘要:二叉树: 1.获取树的深度 class Program { static void Main(string[] args) { Node root = new Node() { Value = 1 }; Node level21 = new Node() { Value = 2 }; Node le
阅读全文
摘要:It is worth noting that only four arithmetic operations of single digits are implemented in the demo, and the division only retains integers. If you w
阅读全文
摘要:1.前言 排序是数据处理过程中经常使用的一种操作,其主要目的是便于查找。根据排序的方法大致可以分为插入排序、交换排序、选择排序、归并排序以及分配排序。以下内容将对各个排序算法的实现过程进行分析,以及各自的时间复杂度进行比较。 2.插入排序 插入排序的主要思想是:每次将一个待排序的记录按其关键码的大小
阅读全文