We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Tag: Comparator

C++ : Map Tutorial -Part 2: Map and External Sorting Criteria / Comparator

In this article we will discuss how to use external sorting criteria for keys in std::map and points that we need to take care with external sorting criteria. Default sorting criteria for keys in std::map is operator “<” i.e. std::less<T>. So, while creating std::map if we don’t specify the external sorting criteria then default criteria …

C++ : Map Tutorial -Part 2: Map and External Sorting Criteria / ComparatorRead More

c++ std::set example and tutorial with external Sorting criteria | Comparator

In this article we will see how to use external Sorting Criteria i.e. Comparator in std::set. Suppose our class is Message that contains three properties i.e. • Member content • Sending User Name • Receiving User Name Advertisements Requirement: we want to keep only single message sent by each user i.e. only one sent message …

c++ std::set example and tutorial with external Sorting criteria | ComparatorRead More

C++ : How to Sort a List of objects with custom Comparator or lambda function

In this example we will discuss different ways to sort a std::list of user defined data types with custom comparators or lambda functions. Suppose we have a type Player that contains Id and name. Advertisements struct Player { int id; std::string name; Player(int playerId, std::string playerName) : id(playerId), name(playerName) { } bool operator <(const Player …

C++ : How to Sort a List of objects with custom Comparator or lambda functionRead More

Python: How to sort a list of tuples by 2nd Item using Lambda Function or Comparator

In this article we will discuss how to sort a list of tuple using 2nd or i th item of tuple. Suppose we have a list of tuple i.e. words and thier frequency count, Advertisements # List of tuples i.e. word and its frequency count wordFreq = [ (‘the’ , 34) , (‘at’ , 23), …

Python: How to sort a list of tuples by 2nd Item using Lambda Function or ComparatorRead More

Cart

Your Cart is Empty

Back To Shop