Just thought I'd share what I've been working on lately.

Heap: https://repl.it/@AmyShackles/Heap/...
Array: https://repl.it/@AmyShackles/...
Binary Tree: https://repl.it/@AmyShackles/...

(I'm so freaking tired.)

  • 1
    I don't have the slightest idea of what this is? I feel dumb
  • 1
    @ilechuks73 No reason to feel dumb. I’m just implementing different data structures in JavaScript. Nothing exciting, fancy, or even particularly interesting.
  • 0
    Nice! Do big-o’s match?
  • 1
    @uyouthe I would be surprised if they didn’t.
  • 1
    Heaps/heapsort is probably my favourite data structure/sorting algorithm combination. It's just so satisfying.
  • 1
    @RememberMe It took me way too long to understand why Floyd’s Heap Construction works. I could figure out why you end at position 1, but couldn’t figure out why in the hell you start from the size of the array integer divided by two. So.... drew different sized trees to try to figure out the pattern. Felt like a fucking idiot when the answer was “ah, it is the index of the last parent node”.
  • 1
    Nice work! I'll take this as an inspiration to implement graphs and trees in a few different languages that I commonly work with. It's something I've been putting off for quite a while.
Add Comment