GithubHelp home page GithubHelp logo

algrithmproj's Introduction

一些简单算法的源码


class Fabonacci

列举了斐波那契数列的两种算法,并且比较了其性能 总结:递归是从大到小,有助于我们细分问题,但是对计算机而言,递归会增加许多重复的计算

class LongestSubstring

求两个字符串的最大子串(动态规划) 总结:将两个字符串的比较结果映射到一张二维数组表上,并在二维数组表的对应位置上计算其重复元素的个数

class BinarySearch

二分法 总结:使用二分法的前提是一组有序的数列

class SortMethods.BubbleSort(int[] arr)

冒泡排序 总结:冒泡排序是每一个数和剩下所有的数进行比较

class SortMethods.SelectSort(int[] arr)

选择排序 总结:每次选取最大的数放在行尾

class SortMethods.QuickSort(int[] arr,int begin, int end)

快速排序 总结:D&C 分而治之,由上至下

class GraphSearch.BreadthFirstSearch(Dictionary<T,T[]> dict, Predicate predicate)

广度优先搜索图 总结:

  1. Dictionary<T,T[]> dict 表示图的先后顺序
  2. Queue queue 表示图的搜索顺序
  3. List list 表示已经搜索过的节点

此例中路径的计算方法有误,需重构

class GraphSearch.DijkstraSearch(Dictionary<T,Dictionary<T,int>> dict,Predicate predicate = null)

狄克斯特拉算法 搜索加权图
例子
图
执行结果
运行结果

总结:需要优化,代码过于复杂,容易遗忘中间过程

algrithmproj's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.