How would you represent a Rubik’s Cube in code?

This ACM Paper describes several alternative ways that it has used to represent a rubik’s cube and compares them against eachother. Sadly, I don’t have an account to get the full text but the description states: Seven alternative representations of Rubik’s Cube are presented and compared: a 3-by-3-by-3 array of 3-digit integers; a 6-by-3-by-3 array … Read more

What is the intuition behind the Fibonacci heap data structure?

This answer is going to be pretty long, but I hope it helps provide some insight as to where the Fibonacci heap comes from. I’m going to assume that you’re already familiar with binomial heaps and amortized analysis. Motivation: Why Fibonacci Heaps? Before jumping into Fibonacci heaps, it’s probably good to explore why we even … Read more

Designing a web crawler

If you want to get a detailed answer take a look at section 3.8 this paper, which describes the URL-seen test of a modern scraper: In the course of extracting links, any Web crawler will encounter multiple links to the same document. To avoid downloading and processing a document multiple times, a URL-seen test must … Read more

Why is it better to have 100 functions operate on one data structure than 10 functions on 10 data structure

The quote is from Alan Perlis’ Epigrams on Programming, which was published in 1982. The meaning of this quote is embodied well in Lisp, where there are multitudes of functions that operate and deal specifically with lists, and you could accomplish a lot just with lists and the assortment of functions that operate on lists, … Read more

Statistical performance of purely functional maps and sets

These are basically research topics, and the results are generally given in the form of conclusions, while the statistical data is hidden. One can have statistical analysis on their own data though. For the benchmarks, better go through the implementation details. The 3rd part of the question is a very subjective matter, and the actual … Read more