1. Any Ip address with subnet mask (ex [url removed, login to view])
2. Option to be given (1. Broadcast address of given ip subnet , 2. Sub-partition id in which the ip is stored, 3. Usage in % for all sub-partitions)
If Option1 is given as input : Broadcast address - [url removed, login to view]
If Option 2 as input: Sub-partition id– 23
If option 3 as input: Display % used in each sub-partition
Sub part (0) – 10%
Sub part (1) – 18%
Sub part (31) – 0%
Create sub-partitions for each subnet. We have 32 subnets and so create 32 sub-partitions using any data structure.
For any given Ip and subnet, calculate broadcast address and based on the given ip subnet check in which sub-partition it has to be stored and store it.
In case, if some sub-partition is filled with frequent input from same subnet, then store the ip in any other subsequent subnet which is not used (i.e 0% used).
Display in which sub-partition id the given ip subnet is stored and display the % of each sub-partition used every time for given input based on the input option provided by the user.