Given a Singly Linked List, write a function reverse() that reverses the list. Also determine the complexity of your function in terms of Big-Oh notation. While reversing the list, you must not use...


In C++ Programming Please


Given a Singly Linked List, write a function reverse() that reverses the list. Also<br>determine the complexity of your function in terms of Big-Oh notation. While reversing<br>the list, you must not use any additional list or arrays.<br>For example, the given list is:<br>head → 1→2→3→4→ 5→ NULL<br>The output should be: head → 5→ 4 → 3 → 2→ 1→ NULL<br>While writing the function, consider the following Node class.<br>class Node{<br>public:<br>int key;<br>Node* next;<br>

Extracted text: Given a Singly Linked List, write a function reverse() that reverses the list. Also determine the complexity of your function in terms of Big-Oh notation. While reversing the list, you must not use any additional list or arrays. For example, the given list is: head → 1→2→3→4→ 5→ NULL The output should be: head → 5→ 4 → 3 → 2→ 1→ NULL While writing the function, consider the following Node class. class Node{ public: int key; Node* next;

Jun 03, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here