Description
We have a group of people in which an ordered popularity relation is defined between person pairs. If there exist a relation such that (P1,P2) this means that A thinks that B is popular. The relation is transitive which means that if the relations (P1,P2) and (P2,P3) exist, than (P1,P3) also exist event if it is not specified by the input pairs. You are supposed to write a Java program which finds the people who are considered popular by every other person.
Input (input.txt)
- Line 1: Two space-separated integers, N (number of people) and M (number of ordered relations)
- Lines 2..1+M: Two space-separated numbers P1 and P2, meaning that P1 thinks P2 is popular.
Output
* Line 1: An integer which represents the number of people who are considered popular by every other person.
Sample Input
3 3
- 2
- 1
2 3
Sample Output
1

![[Solved] CSE222-Data Structures Spring HW #8](https://assignmentchef.com/wp-content/uploads/2022/08/downloadzip.jpg)

![[SOLVED] Cse222 – problem: you have mined a large slab or marble from a quarry. for simplicity, suppose the marble slab is a rectangle measuring n centimeters in height and m centimeters in width. you want to cut the slab into smaller rectangles of integral pieces (i.e. every small rectangle piece should be a cm by b cm dimension for positive integers a and b) of various sizes. you have a marble saw that can make either horizontal or vertical cuts across any rectangular slab. at any time, you can query the spot price p[x, y] by an x cm by y cm marble rectangle in o(1)-time, for any positive integers x and y.](https://assignmentchef.com/wp-content/uploads/2022/08/downloadzip-1200x1200.jpg)
Reviews
There are no reviews yet.