S
sara
I want to create a PriorityQueue pq which contains vectors of integers
and the priority is based on the size of the vector representing each
member. The declaration is as following:
PriorityQueue<Vector<Integer>> pq = new PriorityQueue<Vector<Integer>>
(new PriorityQueueComparator());
where PriorityQueueComparator is a comparator defined by myself.
I want to find the top element of pq, say t and remove any element of
t from other vectors. For example for the following pq:
pq={[1,2,3], [2,3],[3,4]}
I want to any element of [1,2,3] from other member of pq, i.e., [2,5],
[3,4]. Therefore, pq should become pq={[1,2,3],[4],[]}. The problem is
when I use Iterator to iterate over pq members and update them, the
priority of the members based on their size are not kept. In other
words, for this example, pq={[1,2,3],[],[4]} instead of {[1,2,3],[4],
[]}. Is there anyway to update members of pq and update it accordingly?
and the priority is based on the size of the vector representing each
member. The declaration is as following:
PriorityQueue<Vector<Integer>> pq = new PriorityQueue<Vector<Integer>>
(new PriorityQueueComparator());
where PriorityQueueComparator is a comparator defined by myself.
I want to find the top element of pq, say t and remove any element of
t from other vectors. For example for the following pq:
pq={[1,2,3], [2,3],[3,4]}
I want to any element of [1,2,3] from other member of pq, i.e., [2,5],
[3,4]. Therefore, pq should become pq={[1,2,3],[4],[]}. The problem is
when I use Iterator to iterate over pq members and update them, the
priority of the members based on their size are not kept. In other
words, for this example, pq={[1,2,3],[],[4]} instead of {[1,2,3],[4],
[]}. Is there anyway to update members of pq and update it accordingly?