+1 714-215-3097

(Solved) : Write Function Executes O N Linear Time Reverse List Named Reverselist Functions Take Lis Q35614403

Write a function that executes in O(n) linear time to reverse alist, named reverseList(). The functions should take a list (ofintegers) and the list length as its parameters.

Hint: while multiple approaches are possible, a simple solutionis similar to our partitionList() function from our sortingexercise. Simply swap the left and right values while moving downfrom both ends of the list.

Leave a Reply

Your email address will not be published. Required fields are marked *