## Undo that mess

September 12, 2017

During last marking season (at the end of the semester), I had, of course, to grade a lot of assignments. For some reason, every semester, I have a good number of students that write code like they just don’t care. I get code that looks like this:

int fonction              (int random_spacing)^M{           ^M
int            niaiseuses;

for (int i=0;i<random_spacing;         i++){
{
{
std::cout
<< bleh
<< std::endl;
}}

}
}


There’s a bit of everything. Random spacing. Traces of conversions from one OS to another, braces at the end of line. Of course, they lose points, but that doesn’t make the code any easier to read. In a previous installment, I proposed something to rebuild the whitespaces only. Now, let’s see how we can repair as many defects as possible with an Emacs function.

## ln n!

February 23, 2016

In the course of analyzing an algorithm, I used the simplifying hypothesis that the cost function is

$\displaystyle c(n)\approx\sum_{i_1}^n \lg i=\lg n!$.

That expression is cumbersome but we can get a really good simplified function to use as a proxy. Let’s see how.