Question: Poset class java implementation: Write two methods minimal() and maximal() that return the set of minimal and maximal elements of P, respectively. Recall that xP

Poset class java implementation:

Write two methods minimal() and maximal() that return the set of minimal and maximal elements of P, respectively.

Recall that xP is minimal if for all yP{x}, yx

It might be helpful to write a helper function, e.g., minimal(Set S), that finds the minimal elements of a subset SP, and then call it with S=P to get the answer for the whole poset.

Poset class java implementation: Write two methods minimal() and maximal() that return

9 public class Poset 10 private int n; // size (number of elements) in this partially ordered set 12 13 14 15 16 17 18 19 20 21 Initialize partially order set (poset) based on a Hasse diagram. @param H Hasse diagram in adjacency list format (a map where the key is x an element of the set, and the value value is list of direct* successors) public Poset (Map> H) i n = H.size ( ) ; checkInput (H); throw new Unsupported0perationException ("implement me!"); 23 24 25 26 27 28 29 30 31 32 kReturns the set of maximal elements k @return the set of maximal elements public Set maximal) t throw new UnsupportedoperationException("implement me!"); 34 35 36 37 38 39 40 41 42 43 /skok k Returns the set of maximum elements k@return the maximum element or -1 if no such element exists public int maximum() throw new Unsupported0perationException ("implement me!"); kak kReturns the set of minimal elements. k @return the set of minimal elements 45 46

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!