Skip to content

Instantly share code, notes, and snippets.

@lazywithclass
Last active March 21, 2017 04:07
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save lazywithclass/6affd754cbf80feeb2b1fc36403282ce to your computer and use it in GitHub Desktop.
[RC Diary] Whitepapers love (-87)

[RC Diary] Whitepapers love (-87)

Printing path in graph

Continuing from yesterday's problem the problem was using path.push, I changed that so that I wasn't changing the array in place:

function isPath(current, end, path) {
  if (current == end) return console.log(path.concat([current]))
  getNeighbours(current).forEach(function(neighbour) {
    isPath(neighbour, end, path.concat([current]))
  })
  return false
}

and this of course works out of the box thanks to recursion the involved call stacks. For example for C -> E given

graph

that solution returns both [ 'C', 'B', 'D', 'E' ] and [ 'C', 'D', 'E' ].

It's interesting to note how pushing to the array modifies path across recursion call stack, it would be good to remember this property as it might come handy in the future.

Out of the tar pit

Finished reading, have some notes ready, now I have to polish them so I can present on Monday. The paper is amazing by the way, so many concepts in there, I wonder if there's space for yet another JavaScript library for creating UIs.

I think I will read more whitepapers from now on, they're not as difficult as I thought they would be!

Also there's one I want to read next, it's about code coverage: http://cs.au.dk/~cqa/papers/issta2016-goodenough/paper.pdf

Plans

Sunday

  • videos from Chomsky - find which ones are the best and get them
  • visual representation of Djikstra algorithm
  • "check that parens are balanced" exercise

Backlog

  • still need some attention needed for timsort, radix sort
  • chapter 3 of the little schemer in Clojure
  • allow some time to think
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment