This might be very vague,stupid and nonsense question but I want to ask.I have learnt how to make own Comparators.So can anybody please mention some links of question which can require to make our own comparetor function :)
# | User | Rating |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
# | User | Contrib. |
---|---|---|
1 | cry | 164 |
1 | maomao90 | 164 |
3 | Um_nik | 163 |
4 | atcoder_official | 160 |
5 | -is-this-fft- | 158 |
6 | adamant | 157 |
6 | awoo | 157 |
8 | TheScrasse | 154 |
8 | nor | 154 |
10 | djm03178 | 153 |
This might be very vague,stupid and nonsense question but I want to ask.I have learnt how to make own Comparators.So can anybody please mention some links of question which can require to make our own comparetor function :)
Name |
---|
comparators are basically boolean functions which like you think, are used for comparing data on basis of a parameter. they can be used in a variety of places, where ordering of data is done on basis of a parameter (eg sorting)
lets take
std::sort()
in C++. By default, it sorts data in ascending order. Suppose you want to sort a list of numbers on the basis of count of digit '5' in them in ascending order. For convenience of this task, we take numbers as a string and write comparator for the sort functioncode
sorry for weak english and c++ isnt my primary language
265C - Escape from Stones
uva use next_permutation with an appropriate comparator function
also it is useful to learn how to define comparators for data structures like maps and sets you can see this if you are interested