The Art of Sorting!

When Art is combined with Science and vice versa, it has a magical quality! I suppose if you are movie goer, you should be intensely aware of it, especially if you watched this year’s Oscars front runner – The shape of water.

People have done some wonderfully inspiring stuff around illustrating and promoting understanding of algorithmic (and mathematical) concepts.  Sorting algorithms, which deal with arranging objects (say, numbers) in ascending or descending order somehow lend themselves to a few such creative exercises. Here are two examples which I really enjoy using while teaching my Algorithms classes. The best quality they have is they  wake up students (with a bang, I should say) from the deep sleep induced by a tough lecture, and even infuse some with a love of algorithms (at least I fantasize so).

  1. Sound and Fury: The video below titled 15 sorting algorithms in 16 minutes, probably my favourite ‘cool-aid’, is by Timo Bingmann from Kalsruhe (KIT). It’s quite fascinating to see how he uses the numeric values to generate the plots and the relative difference of the compared values to generate the sound. The video has a mere 4.1 Million views so don’t stress if you add a bit more to the count!

The closest I came to doing something like this is when as a high school student, I wrote a program in the programming language Basica that plotted the initials of a girl I liked using a cosine function. Do try that some time!

Details about the above video and its companions, the algorithms behind their generation and the complete source code is available at – if you like, download and have fun!!

2. Sorting Come Dancing: Now, on to the ‘sorting dances’. This group Algorhythmics from Sapentia University, Romania, seem to have a real affinity for dancing their algorithms! They have a number of well known folk dances which end up doing sorting or even other things such as linear and binary search. Watch the numbers Quick Sort themselves by doing a Hungarian dance!!

I wonder how another dance, say an Indian classical dance, effect quick sort! ;). Watch more of their dancing at their youtube channel: AlgoRythmics

I have issued a challenge to my UG year 1 Algorithms class to see if they can come up with something similarly creative. Considering that Loughborough University is ranked the number 1 sports university in the world, I wouldn’t be surprised if it had some sporty angle to it. Let’s wait and watch!


A week in Bergen!

…to try to fix a marriage between distributed computing and parametrised complexity!

uib Høyteknologisenteret: Unfortunately it is not at all as sunny in the picture (rain, rain everywhere!) 😉


This is ‘working day’ 2 of my week in Bergen! I was delighted to be invited by the incredible Saket Saurabh to visit their world leading research department. The aim of this week is for me to give a series of lectures (one per day (1.5 hrs)! – I am hoping that my new postdoc Jonas Lefevre will take one for me 😉 on distributed computing with the aim to find intersections and possible  influences between distributed algorithms and parametrized complexity. I hope I have only a fraction of the energy that Saket has in managing his 12+ PhD students and postdocs 🙂

It’s exciting being here and looking forward to a really productive week!




PhD studentship in algorithms/theory available again!

Funded PhD studentship in algorithms/theory at

A PhD studentship similar in description to the one advertised earlier is available. The application deadline is rather short: July 3rd! Details and an application link are available at

We seek candidates with strong interest in and willing to explore topics from, but not restricted to the following:  i) Graph algorithms and theory, ii) Self-healing, byzantine and other forms of resilient algorithms, iii) Compact routing and memory limited algorithms, iv) Static and dynamic Leader election and consensus, v) Connections between distributed algorithms and research areas such as parameterised complexity, topology, combinatorics, communication complexity, spectral, algebraic tools, vi) Algorithmic game theory and decision making, vi) Modelling and application to modern networks such as IOT and SDN.

The successful candidate will work closely with active research groups centred around both CS theory and networks. In particular, the candidate can benefit from interaction with upcoming research on compact self-healing routing algorithms supported by EPSRC (EPSRC research grant EP/P021247/1).

Postdoc position: now accepting applications

Advertisement for postdoc position for working on distributed algorithms under the EPSRC project COSHER is now live at

Below is the message I have sent out to a few mailing lists!

Here are some related blog posts on this same blog related to the opening and the research:

Postdoc in distributed algorithms required

My exciting EPSRC first grant!

Belfast to Mexico City via Self-healing Compact Routing!


Applications are invited for a postdoctoral research associate position in the area of distributed algorithms in the research group of Dr. Amitabh Trehan at Loughborough University Computer Science.

The position is funded by an EPSRC first grant to work on an exciting new project called COSHER:  Compact Self-healing Routing (COSHER) (RCUK link) that aims to combine research on compact routing with resilience (self-healing) using the standard message-passing modelling of networks (as graphs) and mathematical analysis of proposed algorithms. The position is for a one-year fixed term in the present instance providing a competitive 12 month salary with standard benefits.  The expected start date is Fall 2017 (Available to begin as early as July 1, 2017).

The successful candidate should have a PhD in Computer Science, mathematics or related disciplines with knowledge and understanding of algorithms and CS theory and/or networks. Experience in designing distributed/network algorithms is highly desirable.


More details and a link to the application is available at

The application deadline is June 1st, 2017.

The (online) application should include (1) Education details, (2) Supporting information in the form of a brief cover letter and research interest statement, (3) Names and contact information of three referees, (4) CV and publications list.

Informal enquiries should be made to Dr. Amitabh Trehan by email at or by telephone on +44 (0)1509 222564.

Please also refer to the blog for more pointers on the research.

Dr. Amitabh Trehan
Computer Sciece
Loughborough University
Loughborough, England.

My exciting EPSRC first grant!

COSHER: Compact Self-Healing Routing at the RCUK portal:

When I moved to Loughborough in February, I got one of the best gifts possible. In my first week here, I got the news that I had been awarded an EPSRC first grant. I had applied the grant while I was at Queen’s University Belfast – in fact, physically, I was in an AirBnB rental in Coycocan, Mexico city (as a visitor to UNAM for a Newton fund grant) when I had sent in the application. It was a stressful process, a stressful about three years procrastinating and agonising over the content and language. The primary reason being that you have only one shot at the ‘first grant’.

Anyways, it came through (hurrah!). Once you have been through one of these submissions, you discover this amazing maze of systems that bestow upon you the resources to help you conduct research!! You get to add a number of new keywords to your dictionary.

In brief, what happens is that you submit your application on the Je-S system with a number of documents after you have agonised, procrastinated, discussed, debated, tried to get industry support (or decide not to get, as in my case), written, re-written, accidentally deleted the whole application (as in my case on the eve of submission), got the application re-instated by calling somebody in charge etc etc… Then, the documents (and by extension, your career) passes through the hands of expert reviewers whose advice goes before a panel (which meet a few times a year). One fine (or horrible) day all is revealed – as in my case in the EPSRC ICT Prioritastion panel Jan 2017. As one can see, there are a number of different grants considered – the first grant seems to have a better chance being of relatively smaller value and of lower expectations than, say, the standard grants. In my panel, it seems 6 out of the 7 first grant applicants made it while only 4 out of 12 standard grants did. Sometimes, it can be far worse!

At the end of it all, Research Council UK (RCUK)’s nice sounding Gateway to Research  gives you a listing as a Principal Investigator and your successful project gets its own page and its own life! – Well, the real life for my project begins from July 1st when the money comes in and the expectations begin.


Postdoc in distributed algorithms required

A postdoc position to work with me on an EPSRC research project at Loughborough University is available from July 2017.

I have a position for a 1 year (in the first instance) postdoctoral research associate to work with me at Loughborough University. The position, supported by the EPSRC first grant COSHER (Compact Self-Healing Routing), comes with a good salary (in the UK system) and other perks and trainings. The project is available here at the RCUK gateway. The related research question is described in my earlier post here.

The earliest (and expected) start date is July 1st, 2017, but a later start date may be possible. The formal advertisement will be out in the coming week but please get in touch with me for more details!

Weapons of Math Destruction and the hippocratic oath

Don’t mess with the maths – it can shoot you in the foot! -‘You talking to me, you talking to me…’

Here is a very interesting article on the dangers of the big data hype:

Author Cathy O’Neil (The mathbabe!) in her book Weapons of Math Destruction (What a name!) states that we should remember that predictive models and algorithms are really just “opinions embedded in math.” Well said, indeed.  After all, maths is annother language – a very powerful one for emotionless, ‘logical’ calculus though.

WeaponsMath r4-6-06.jpg

Maybe time for all to take the  Modeler’s Hippocratic Oath (Derman and Wilmott):

I will remember that I didn’t make the world, and it doesn’t satisfy my equations.

∼ Though I will use models boldly to estimate value, I will not be overly impressed by mathematics.

∼ I will never sacrifice reality for elegance without explaining why I have done so.

∼ Nor will I give the people who use my model false comfort about its accuracy. Instead, I will make explicit its assumptions and oversights.

∼ I understand that my work may have enormous effects on society and the economy, many of them beyond my comprehension.