I am trying to calculate the time complexity in the worst case (Tw(n)).
The following conditions apply: