Coder Social home page Coder Social logo

shady831213 / algorithms Goto Github PK

View Code? Open in Web Editor NEW
818.0 25.0 121.0 1.11 MB

CLRS study. Codes are written with golang.

License: MIT License

Go 100.00%
go clrs algorithms heap sort tree hashmap dynamic-programming greedy-algorithms disjoint-set algorithm clrs-study golang binaryheap graph bfs-algorithm dfs-algorithm connected-components

algorithms's Introduction

algorithms

Go Report CardBuild StatusMaintainabilityTest Coverage

CLRS study. Codes are written with golang.


go version: 1.11


algorithms's People

Contributors

shady831213 avatar

Stargazers

Emilio Limo Cliff avatar  avatar Jacob Potter avatar Abbas Garousi avatar kyle loveless avatar Ivan Starodubov avatar zhijian avatar  avatar Mugen avatar  avatar  avatar  avatar  avatar Tomas Tamadamas avatar Gaspar Acevedo Zain avatar  avatar Seyit Kaan Karaalioglu avatar Andre Mason avatar Bro avatar  avatar Pike avatar Mayank Verma avatar XuHaoran avatar  avatar  avatar  avatar  avatar Your Pde Lover avatar  avatar Vadim avatar Marin Kitagawa avatar 作怪 avatar  avatar the void avatar  avatar Will Slade avatar Will Ruiz avatar 卡卡罗特 avatar  avatar novice2017 avatar TrevorChaney avatar Marcos Schlesser avatar Gilbert Wong avatar Hendriktio Freizello avatar Bruno Quindeler avatar  avatar Tô Thành Hiệp avatar  avatar Orim Dominic Adah avatar Issac avatar Dritan Xhezo avatar KingYen. avatar  avatar Tejas G avatar Robin avatar Malik Wali avatar Quoc-Anh Nguyen avatar Trịnh Đức Bảo Linh(Kevin) avatar  avatar Sany avatar  avatar Eugene Lamskoy avatar s3rj1k avatar esteban avatar  avatar qi wu avatar  avatar 潘金豪 avatar Yongyuth "First" Chuankhuntod avatar ashwinyue avatar SuSuSoo avatar Denys K avatar  avatar Vyacheslav Syrovatsky avatar Art A. avatar Fabrice Boyer avatar  avatar  avatar Ivan Suroegin avatar Soderberg avatar Enes Diler avatar  avatar  avatar Wilson avatar  avatar Radu avatar Rishi Yadav avatar Alex Szabo avatar Vargha Csongor avatar shuai avatar  avatar hollis avatar  avatar Laurence Chau avatar  avatar  avatar Jyotirmoy Barman avatar Anton Fiadotau avatar  avatar Talha avatar

Watchers

 avatar  avatar Victor Login avatar zhaorenwei avatar funron avatar Mayank Verma avatar Rajesh Gopidi avatar SEAN avatar  えいじ avatar  avatar Gopi Krishna avatar  avatar  avatar Anurag V avatar deldesir avatar  avatar  avatar slgo avatar Krishna avatar Bharati avatar Rochana Atapattu avatar  avatar Xena avatar  avatar  avatar

algorithms's Issues

More sqrts than you can shake a stick at

During your TSP you continually call sqrt while calculating distances. This is fairly wasteful, since you don't actually care about the root until the end of the function.

func dist2(lhs Point, rhs Point) float64 {
  dx, dy := lhs.x - rhs.x, lhs.y - rhs.y
  return (dx*dx) + (dy * dy)
}

func find_closest_2(points []Point) (float64, *Point, *Point, error) {
  if len(points) < 2 {
    return 0, nil, nil, errors.New("must be at least 2 points")
  }
  var first, second *Point
  var shortest_dist float64 = math.MaxFloat64
  for lhs := 0; lhs < len(points) - 1; lhs++ {
    for rhs := lhs + 1; rhs < len(points); rhs++ {
      d2 := dist2(lhs, rhs)
      if d2 < shortest_dist {
        first, second = &lhs, &rhs
        shortest_dist = d2
      }
    }
  }
  return math.sqrt(shortest_dist), first, second, nil
}

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.