The cases are then sorted in descending order of staff shortage. The procedure for assigning idle nurses to cases in SD is
based on the availability of nurses who can perform the required role on the case (See the
flowchart in Appendix D). Algorithm 2 and Fig. 1 indicate how to find the best nurse to
assign to a case with a shortage. In the worst case, the ‘‘for’’ loop in Algorithm 2 has to be
executed for all cases and nurses, so its complexity is O(mn log(n)), with m being the number of
cases, and
n being the number of nurses.