Write a method, truncate (i), that truncates a DLList at position i 1 answer below »
Write a method, truncate (i), that truncates a DLList at position i. After executing this method, the size of the list will be i and it should contain only the elements at indices 0,…, i − 1. The return value is another DLList that contains the elements at indices i,…, n − 1. This method should run in
O(min{i, n − i}) time.