Java代写 | CITS2200 Project 2021


Problem Specification
You must implement the following four functions, and provide a report on your implementations.
Each function is worth a different number of marks for a total of 40 marks. Details for what the
mark breakdowns mean are provided below.
All questions consider a theoretical model of a computer network. This network contains N
distinct devices, each of which is assigned a unique integer id in the range [0, N) . A pair of
devices in the network can be physically linked such that one device is able to transmit network
packets to the other. It is not necessarily the case that a physical link can be used to transmit in
both directions, but some links may be. If a pair of devices are not physically linked, they are still
able to transmit network packets if there is a sequence of physical links from the sending device
to the receiving device such that the packet can be passed along via multiple devices to reach its
destination. The number of physical links a packet passes through to reach its destination is
called the number of hops it takes or the distance it travels.
For each of the below functions, a specification of the structure of the network is passed as an
int[][] argument called adjlist . A device with id v is considered adjacent to a device with
id u if they are physically linked such that u is able to transmit a packet directly to v . The
array adjlist[u] is a list of all the device ids that are adjacent to u . For example, if
adjlist[1] is the array {0, 2} , this means that device 1 is able to transmit packets to devices
0 and 2.
Time complexity specification in this document use D for the number of devices in the network,
L for the number of links, and N for the size of the network ( D + L ).
public boolean allDevicesConnected(int[][] adjlist) (6
Determine if all of the devices in the network are connected to the network. Devices are
considered to be connected to the network if they can transmit (including via other devices) to
every other device in the network. If all devices in the network are connected, then return true ,
and return false otherwise.
int[][] adjlist : The structure of the network
Return: boolean indicating whether all of the devices in the network are connected to the

Marks (6 total):
Correctness: +3 marks
O(N) : +1 mark
Quality: +2 marks
public int numPaths(int[][] adjlist, int src, int dst)
(10 marks)
Determine the number of different paths a packet can take in the network to get from a
transmitting device to a receiving device. A device will only transmit a packet to a device that is
closer to the destination, where the distance to the destination is the minimum number of hops
between a device and the destination.
int[][] adjlist : The structure of the network
int src : The device id of the transmitting device
int dst : The device id of the receiving device
Return: int The number of possible different paths in the network that a packet may take from
the transmitting to receiving device
Marks (10 total):
Correctness: +4 marks
O(N^2) : +1 mark
O(N) : +2 marks
Quality: +3 marks



本网站支持淘宝 支付宝 微信支付  paypal等等交易。如果不放心可以用淘宝交易!

E-mail:  微信:itcsdx