Running head: C++ DATA STRUCTURESCPSC 131 Homework 6Students NameInstitution AffiliationDateC++ DATA STRUCTURES#1 Recursiona) For each of the following problems, what is the recursive step and what is the base case?Answer in one sentence; no need to write C++ code:i) Traversing an SLL to find the first element less than a given value, find(ptr, value)Recursive Step:For a Singly-linked-list only forward direction is possible. Here the function find(ptr, value) issearching the position of the linked list where tail< value.Beginning from the head,1. check, if the end of a list hasn't been reached yet;2. check if current node value< given value3. if condition does not satisfy current node becomes previous and next node becomescurrent. Go to the step 1Let say, given SSL isSuppose, given value is 20. So, the node value should be less than 20. So the SLL will work asfollows,So when current node=head=50, next node=90Next step, current node=90, next node=8Next step, current node=8, next step=10Now, 8 <20 and=""> <20 So="" initial="" is="" Case:So="" hereBase="" step="" head="tail" and="" recursion="" function="" checks="" condition="" every="" DATA="" Returning="" sum="" elements="" in="" an="" array="" size="" Step:In="" this="" first="" we="" see="" the="" value="" of="" when="" K="">< NNow the indexing works as follows,1. sum = K-th value + sum . Here sum = 02. sum = (K-1)th value + sum . Here sum= K-th va ...
To Order an Original Plagiarism Free Paper on the Same Topic Click Here












Other samples, services and questions:
When you use PaperHelp, you save one valuable — TIME
You can spend it for more important things than paper writing.