Code Monkey home page Code Monkey logo

datastructure's Introduction

DataStructure

Just some practice about data structure

ClassTest.py

  • 简单的类的声明和实例化

LinkedList.py

  • 单向链表的实现,可以直接一个一个插入建,也可以直接用一个数组建

  • 单向链表中节点的插入、删除、直接往后加

BinarySearchTree.py

  • 二叉搜索树的实现
  • 插入节点,删除节点,找最小节点

Graph-AdjacencyList.py

  • Implement Graph as the adjacency list format

  • Breadth-First Search的实现,输出一个Breadth-first Search Tree

  • Implement the Depth-first Search algorithm

  • Implement Bellman-Ford algorithm and output the shortest path

  • Implement Dijkstra algorithm and output the shortest path

Bellman-Ford computes the shortest paths from a single source vertex to all of the other vertices in a weighted digraph.

比Dijkstra慢,但是能处理有负边的图;原理就是对每条边反复relax,若n-1次后还能更新,说明图中有负环

Dijkstra好难写,复杂度还不对,现在是O(n^3)

Dijkstra的原理

有一个关于self.Vertexes = [Vertex()] * size 赋值后,所有的list单元指向同一个地址的问题

好像是浅拷贝和深拷贝的问题

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.