I am from java background, I need to something like this
public class Item implements Comparable<Item> {
int score;
ArrayList<Integer> arr;
@Override
public int compareTo(Item o2) {
return score != o2.score ? score - o2.score : arr.size() - o2.arr.size();
}
public static void main(String[] args) {
PriorityQueue<Item> p = new PriorityQueue<Item>();
}
}
So I have a class which has two variable, score and list. There is a calculation for natural ordering for also too.
Could somebody please tell me how to do it python? heapq does not work for me, because my score function checks score on the basis of two variables not one.