Giter Club home page Giter Club logo

datastructure-algorithm's Introduction

数据结构和算法

数据结构介绍

数据结构是计算机存储、组织数据的方式。数据结构是组织数据元素的集合,这些数据元素之间存在一种或多种特定关系。在解决某种问题时,选择合适的数据结构可以带来更高的运行或者存储效率。

算法介绍

算法是一系列解决问题的代码指令,算法代表着用系统的方法描述解决问题的策略。也就是说,能够对一定符合规定的输入,在有限时间内获得所要求的输出。不同的算法完成同样的任务所花费的时间或空间效率是不同的。一个算法的优劣可以用空间复杂度与时间复杂度来衡量。

数据结构和算法的关系

关系:

  • 数据结构是底层,算法高层
  • 数据结构为算法提供服务
  • 算法围绕数据结构操作

程序等于数据结构 + 算法

数据结构是算法实现的基础,算法总是要依赖于某种数据结构来实现的。往往是在发展一种算法的时候,构建了适合于这种算法的数据结构。

当然两者也是有一定区别的,算法更加的抽象一些,侧重于对问题的建模,而数据结构则是具体实现方面的问题了,两者是相辅相成的。

线性结构和非线性结构

数据结构包括线性结构和非线性结构。

线性结构是最常用的数据结构,特点是数据元素之间存在一对一的关系。线性结构有两种存储方式,一种是顺序存储叫做顺序表,其存储的元素在内存中是连续的,另外一种叫做链表,其存储的元素不一定是连续的,元素节点中存放数据元素以及相邻元素的地址信息。常见的线性结构有数组、队列、链表和栈。

非线性结构包括二维数组、多维数组、广义表、树和图。

数据结构

稀疏数组

队列

链表

哈希表

算法

递归

排序

查找

分治算法

KMP算法

贪心算法

普里姆(Prim)算法

克鲁斯卡尔算法

马踏棋盘算法

datastructure-algorithm's People

Contributors

dxx avatar

Watchers

James Cloos 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.