Question: 5 Exercise: Refresher on Nodes, Pointers, etc. (20 pt.) In this exercise, we'll write some code that will set you up for implementing Karat suba's


5 Exercise: Refresher on Nodes, Pointers, etc. (20 pt.) In this exercise, we'll write some code that will set you up for implementing Karat suba's algorithm later in the class (maybe as extra credit!). 5.1 Adding Two Numbers (10 pt.) Almost every programming languages already has 't' and implemented for you, on integers. So to make this more interesting your task is to write the function add, which given two numbers represented as linked lists of single digit integers, returns their sum as a linked list of integers. Return the head node. The linked list is represented as follows: template head -> 3 -> 2 -> 1). Some samples for add Modeint qabuputi kat(123); 13 -> 2 -> 1) Modeint Input2- nakalist (242); // 2 -> 6 -> 2] Node into thouti - adqInputi, qInput2): std::cout 6 -> 3) (meaning 365) FreeList(Input) frist (Input2): freelist(about); NodeintqInput - List(999); Modeiat qobinput-sakelist(1); Modeint hout2-add (qabiaput, qInput): std::cout -> O -> 1) meaning 1000 freelist(obinputs): freelist (binput 4); freeList(out) 11 Refresher on pointers, memory allocation, and deallocation for your reference: To create a Node object, use Modecinte ptr = new Nodecint>0. new dynamically allocates memory for this . We provided a freelist function that will traverse the linked list and free every node freelist is all we need here, but always remember when you have allocated memory (ie. with 'new' to free it when finished (ie 'delete ptr"). To check whether there are "memory leaks" (i... allocated memory but not deallo cated), you can run valgrind on replit with valgrind-teak-check-full/main Please note that this question is at the upper-end of the C++ intricacies we will learn on in the course. Having familiarity with pointers here will serve as well later on (eg. with trees). [We are expecting: You should implement add in answers.cpp in your starter code] 5.2 Runtime of Addition (10 pt.) The algorithm above forces you to implement addition the way you would normally do it by hand (eg, add numbers and carry when they add to more than 10). In this context let us define operation" as being a l-digit addition. What is the big Oh running time of this algorithm, in terms of where is the length of the input lists (eg. numbers). [We are expecting: A single answer in the form of...) where you've filled in .... No need to prove or argue this is correct, simply provide your