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!




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!


..Being a follow up to the glorious 42 (earlier post) in being two times 42 (almost?) – strong, weak and electromagnetic (but not gravitational) at the same time! eh?

After I published 42,  Fred, a physicist colleague commented that 42 is important in some very fundamental physics and he was disappointed that more hadn’t been made out of this. He also sent some evidence of this grave atrocity!


From my amateur interest in theoretical particle physics (I was a student of Murray Gell Mann, after all 😉 (Well, I can keep that suspense for another blog post) – I know that the search for the Grand Unified Theory (GUT) made some great progress (with ideas such as string theory). Basically, there are 4 fundamental forces – strong, weak, electromagnetic and gravity. It seems like while others have agreed to be unifired, gravity has been a b*** and has refused to be unified – Any UK/EU readers reading this post? 😉

Well, getting back to 42, apparently, at a  particular high energy, the three ‘friendly’ forces become equal in energy of 1/42 (behold, 42 makes an appearance). If you go to the wikipedia page on 42 – you’ll find a number of entries of the importance of 42  – In fact, exactly 42 total entries under Mathematics, Science, Technology, Astronomy and Religion!! – wow, was that intentional?

Q: For a given number x, can I find x interesting things to say about it? I suppose there may be a way to do that!

Now, what about 88! Of course, 88 is two fat ladies! – that’s it! If you’ve ever had the honour to play Tambola! – I remember as a kid being carted around to Tambola games with my mother and family. At least, that adds to interesting things one can say about the first 90 numbers as listed on this Tambola nicknames site. Now, clearly the nicknames site has an Indian bias – where else would the nickname for the number 83 be India wins Cricket World Cup?

PS: ‘R u sure that 9 time 6 equals 42? My child has a different answer.’ – another comment from a careful reader! I hope you caught that in the last post! My answer, of course, would have been to ask Douglas Adams (if he was alive) or to query his faulty super duper computer yet again!