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!


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.

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!

I have moved to Lufbra!

In February, I moved to the department of Computer Science at Loughborough University (called Lufbra or Lboro or other variants, in short) after spending more than three years at Queen’s University Belfast. I am pretty excited about the move and got a really nice welcome with the news of  the award of an EPSRC first grant in my first week here (more on that later). The department has a good mixture of systems and theory and, heartingly, sits in the School of Science (along with Maths and Physics, the right place I feel for CS – Djikstra would have it rather called Computing Science). I will work most closely with the Theory and Networks groups but, in fact, with anybody who’s willing to go to lunch or coffee with me (speaking of which, we have a nice communal and very active Nespresso machine)!

This slideshow requires JavaScript.

Though recent years and, let’s say, world events, have made me wary about news and rankings, this is the right time to brag about Lufbra – top 5  in the Guardian league tables, top 10 in complete University Guide and other rankings (more here), and #1 in student satisfaction rankings.  But what Lufbra is really legendary for is its sports (with alumni like Sebastian Coe and Paula Radcliffe) with it recently been crowned the best sports university in the world. Sports is everywhere on one of the largest closed campuses in the UK with many national and olympic facilities based here. Even more exciting for me is that the  English and Wales Cricket board national cricket performance centre is outside my window and also one of the two international standard cricket grounds on campus! We, at Computer Science have even graduated some test cricketers like Monty Panesar (nice article here on Monty’s story). There will be lot of nice cricket to watch from work over summer 😉

When I was a kid, I  wanted to be a Scientist and a Cricketer (let’s say, I have had moderate success in both ventures) – now, in my office, I’ll be a scientist and watch cricketers!