public:how_parkrun_volunteers_sort_barcodes_-_a_computer_scientist_s_perspective
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
public:how_parkrun_volunteers_sort_barcodes_-_a_computer_scientist_s_perspective [2018/12/28 02:59] – fangfufu | public:how_parkrun_volunteers_sort_barcodes_-_a_computer_scientist_s_perspective [2018/12/28 11:23] (current) – fangfufu | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== How Parkrun volunteers sort barcodes - a computer scientist' | ====== How Parkrun volunteers sort barcodes - a computer scientist' | ||
- | On the Christmas day of 2018, I volunteered at Norwich Parkrun. Towards the end, I ended up helping out with sorting the plastic barcodes. I find the whole process interesting. This is because sorting algorithm is an essential part of computer science curriculum [(https:// | + | On the Christmas day of 2018, I volunteered at Norwich Parkrun. Towards the end, I ended up helping out with sorting the plastic barcodes. I find the whole process interesting. This is because sorting algorithm is an essential part of computer science curriculum [(https:// |
Sorting numbers inside a computer is a bit different to sorting objects in physical world. This is mainly because the uniform cost model does not apply in the physical world [(costmodel > https:// | Sorting numbers inside a computer is a bit different to sorting objects in physical world. This is mainly because the uniform cost model does not apply in the physical world [(costmodel > https:// | ||
- | In this blog post, we analyse the algorithm which Parkrun volunteers use to sort barcodes, using some concepts from computer science. | + | In this blog post, we analyse the algorithm which Parkrun volunteers use to sort barcodes, using some concepts from computer science. This blog post is written in such a way so you can follow it, even if you have not formally studied computer science. |
+ | |||
+ | In short, Parkrun uses bucket sort to sort their barcodes after each event. I do not think I have encountered an implementation of bucket sort on computers, yet I was treated with a real life implementation of bucket sort on Christmas day. | ||
===== Analysis of algorithms | ===== Analysis of algorithms | ||
Line 59: | Line 61: | ||
The first stage establishes a partial ordering [(https:// | The first stage establishes a partial ordering [(https:// | ||
- | ==== Sorting individual buckets ==== | + | ==== Sorting individual buckets |
Different worker threads (volunteers) tend to use different sorting algorithm. Personally I use insertion sort, which is a comparison sort. | Different worker threads (volunteers) tend to use different sorting algorithm. Personally I use insertion sort, which is a comparison sort. | ||
Line 81: | Line 83: | ||
There are also video animation of insertion sort on the Internet: | There are also video animation of insertion sort on the Internet: | ||
<columns 100% - - > | <columns 100% - - > | ||
+ | <WRAP centeralign> | ||
//You might want to turn off the audio for this video. // | //You might want to turn off the audio for this video. // | ||
{{youtube> | {{youtube> | ||
+ | </ | ||
< | < | ||
+ | <WRAP centeralign> | ||
//Leave the audio on for some Romanian folk dance music. // | //Leave the audio on for some Romanian folk dance music. // | ||
{{youtube> | {{youtube> | ||
+ | </ | ||
</ | </ | ||
Line 94: | Line 100: | ||
However there are some physical optimisation which I made. I collapsed consecutive sorted barcodes into clusters. This is because physically inserting a barcode involves moving all the adjacent barcodes, which takes quite a bit of effort on a rough surface. The two figures below illustrate what I meant: | However there are some physical optimisation which I made. I collapsed consecutive sorted barcodes into clusters. This is because physically inserting a barcode involves moving all the adjacent barcodes, which takes quite a bit of effort on a rough surface. The two figures below illustrate what I meant: | ||
- | <columns 100% - - > | + | <columns 100% 50% 50% > |
- | // | + | <WRAP centeralign> |
+ | // | ||
+ | |||
+ | {{: | ||
+ | </ | ||
- | {{ : | ||
< | < | ||
- | //Partially collapsed clusters of consecutive barcodes // | + | <WRAP centeralign> |
+ | //Partially collapsed clusters of consecutive barcodes, this made it much easier to perform insertion. | ||
- | {{ : | + | {{: |
+ | </ | ||
</ | </ | ||
- | ==== Conclusion ==== | + | Preallocation of enough empty space for the missing barcodes should help with the problem as well - that way you don't need to shuffle those out-of-place barcodes. |
+ | |||
+ | ===== Conclusion | ||
I quite enjoyed participating barcode sorting. It is quite of interesting to observe a physical implementation of bucket sort. A lot of computer algorithms are inspired by real life processes. I think perhaps the bucket sort algorithm you learn from textbooks is the abstraction of real life bucket sort process. After all, Wikipedia does not say who came up with bucket sort [(bucketsort)]. It really does make me think - a lot of assumptions in the physical world do not apply in computers, a lot of assumptions that work in computers do not apply in real life. If real life processes can inspire computer algorithms, then surely computer algorithms can inspire real life processes. | I quite enjoyed participating barcode sorting. It is quite of interesting to observe a physical implementation of bucket sort. A lot of computer algorithms are inspired by real life processes. I think perhaps the bucket sort algorithm you learn from textbooks is the abstraction of real life bucket sort process. After all, Wikipedia does not say who came up with bucket sort [(bucketsort)]. It really does make me think - a lot of assumptions in the physical world do not apply in computers, a lot of assumptions that work in computers do not apply in real life. If real life processes can inspire computer algorithms, then surely computer algorithms can inspire real life processes. | ||
- | ==== Further readings ==== | + | ===== Further readings ===== |
+ | There are other topics which link computer science into the way the physical world works, for example operational research [(https:// | ||
public/how_parkrun_volunteers_sort_barcodes_-_a_computer_scientist_s_perspective.1545965966.txt.gz · Last modified: 2018/12/28 02:59 by fangfufu