Can we do better than NumPy in special cases?
Can we do better than NumPy by trading generality? Answer is yes, by using BLAS and C extension.
Why the solution to part 2(AoC21-Day7) works?
Day 7(part2) of this year’s content brought an interesting problem. Many peoples’ solution just worked, but many (including me) had no idea why it worked. This is my attempt to solve that mystery.
Python got me with circular imports!
Yet another way circular import can get you. This blog describes how Python import works, why circular imports cause issue and how to fix it.
NotAeroCalc Part 1: What is NotAeroCalc and how to use it?
I am a Computer Engineer by education and by training. Luckily, we computer engineers do not have to deal with different units. All our units are power of 2. We have sensible names, Kilo, Mega, Giga, you get it. When we get unlucky, there could be a confusion of whether Kilo in the context is $ 2^{10} $ or $ 10^3 $. But that is it.
But in other engineering (and science) branches this is not the case.
How to find the number of unique elements in a stream?
So, I’ve been reading about streaming algorithms. Seems like the journey to streaming algorithms(aka Algorithms for Big Data) starts with the Flajolet-Martin algorithm.
The Problem We are given a sequence <u_0, u_1, u_2, u_3, … , u_n> of n elements. Each u_i comes from the fixed set U of some finite size. We want to see how many elements are unique.
A simple Python code like below can solve the problem, if we have required memory.