Giter Club home page Giter Club logo

leetcoode's Introduction

算法题

1.有序度和逆序度概念分析

有序度: 是数组中具有有序关系的元素对的个数

有序元素对:a[i] <= a[j], 如果 i < j。

逆序度: 与有序度刚好相反

满有序度:对于一组完全有序的数组来说

有序度 = 满有序度 + 逆序度 $$ n*(n-1)/2 $$

2. 插入排序

原理:将一个数组中的数据划分为已排序的区间和未排序的区间。初始时,数组的第一个元素作为已排序区间中的数,核心细想就是每一次从未排序区间开头取一个数,和已排序区间的数做比较,找到合适的位置插入。

  1. 插入排序属于原地排序和稳定排序
  2. 最好的时候时间复杂度:O(n)
  3. 最坏的时候时间复杂度:O(n^2)
  4. 平均时间复杂度:O(n^2)

3. 插入排序为什么比冒泡排序更加受欢迎

虽然两者的时间复杂度同为O(n^2),但是对于实际操作来说,冒泡排序赋值需要3步,而插入排序只是需要一步就搞定了。

4.桶排序

5 二叉查找树

树中任意节点的值,左子树中每个节点的值都要小于这个节点,右子树中每个节点的值都要大于这个节点。

6.平衡二叉查找树

二叉树中任意一个节点的左右子树的高度相差不能大于 1。

leetcoode's People

Contributors

jsluowen avatar

Watchers

 avatar

Forkers

jsqianwei

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.