Giter Club home page Giter Club logo

python-algorithms's Introduction

python-algorithms

This repository contains the code associated with the "Working With Algorithms In Python" Safari Video.

The order of the videos in the final short course is listed below

  1. Log N Behavior *. Big O SideBar
  2. O(n log n) Behavior
  3. Mathematical Algorithms
  4. Brute Force Algorithms
  5. KD Tree Data Structure
  6. DepthFirstSearch
  7. Seven All Pairs Shortest Path
  8. Heap
  9. Single-Source Shortest Path

Each module introduces a real-world problem and presents a Naive approach towards solving that problem. Invariably one can do better, with the right data structure and elegant algorithm. Each module has a corresponding problem that is either closely related, or which can be solved using a variation of the algorithms developed for that module.

The "* Big O SideBar" module introduces terminology used to analyze the algorithms whose code is contained in these modules.

All presentation slides used during the recording of the videos are found in the "Presentation Slides" folder as PDF documents.

python-algorithms's People

Contributors

heineman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-algorithms's Issues

KDNode and nearest

I'm watching your video on Safari. I read your README regarding the KDNode and nearest. Would you give an example of points where lines 99 to 118 is necessary? I tried the following as a test between your code and the revised version of nearest below. Both gave the same output.

kd = KDTree()
kd.add([2,3])
kd.add([3,4])
kd.add([5,5])
kd.add([9,6])
kd.add([4,7])
kd.add([8,1])
kd.add([7,2])
v = kd.nearest((4,4))
print(v.point)

And simplify the function to

  def nearest(self, min_distance, p):
        """Return closest node from given subtree to point."""

        d = self.distance(p)
        result = None
        if (d < min_distance):
            result = self
            min_distance = d

        pt = None
        if self.isAbove(p) and self.above:
            pt = self.above.nearest(min_distance, p)
        elif self.isBelow(p) and self.below:
            pt = self.below.nearest(min_distance, p)
        if pt:
            return pt

        return result

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.