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 | 3985 |
2 | jiangly | 3814 |
3 | jqdai0815 | 3682 |
4 | Benq | 3529 |
5 | orzdevinwang | 3526 |
6 | ksun48 | 3517 |
7 | Radewoosh | 3410 |
8 | hos.lyric | 3399 |
9 | ecnerwala | 3392 |
9 | Um_nik | 3392 |
# | User | Contrib. |
---|---|---|
1 | cry | 169 |
2 | maomao90 | 162 |
2 | Um_nik | 162 |
4 | atcoder_official | 161 |
5 | djm03178 | 158 |
6 | -is-this-fft- | 157 |
7 | adamant | 155 |
8 | Dominater069 | 154 |
8 | awoo | 154 |
10 | luogu_official | 150 |
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