Question
1) Create a function that will print a list out, given the header node. Here is the function header:
void list_print(node * head_ptr)

• Place this function before the main function in your program.
• The function should print out the elements in the list separated by spaces all on one line.
• The function should print an ‘end of line’ after the list data is printed.

2) Carry out the following steps in the program, in main:

- Create a list header and insert the following data in order: 23.5, 45.6, 67.7, 89.8, 12.9
- Print out the list using the function you wrote.

- Create a list with two pointers, one to the head and one to the tail.
- Insert 23.5 into the list (Somewhere in the middle).
- Then insert these elements in order at the tail of the list: 45.6, 67.7, -123.5, 89.9 and 12. and lastly, Print the list.
Solution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references.
Students may use these solutions for personal skill-building and practice.
Unethical use is strictly forbidden.

const node *list_search(const node *head_ptr, const node::value_type &target)
    // Library facilities used: cstdlib
    {
       const node *cursor;

       for (cursor = head_ptr; cursor != NULL; cursor = cursor->link())
            if (target == cursor->data())
                return cursor;
       return NULL;
    }

    node *list_locate(node *head_ptr, size_t position)
    // Library facilities used: cassert, cstdlib
    {
       node *cursor;
       size_t i;

       assert (0 < position);
       cursor = head_ptr;
       for (i = 1; (i < position) && (cursor != NULL); i++)
            cursor = cursor->link();
       return cursor;
    }
This is only a preview of the solution.
Please use the purchase button to see the entire solution.
By purchasing this solution you'll be able to access the following files:
Solution.h
Solution.cpp
Purchase Solution
$25.00 $12.5
Google Pay
Amazon
Paypal
Mastercard
Visacard
Discover
Amex
View Available Computer Science Tutors 639 tutors matched
Ionut
(ionut)
Master of Computer Science
Hi! MSc Applied Informatics & Computer Science Engineer. Practical experience in many CS & IT branches.Research work & homework
5/5 (6,804+ sessions)
1 hour avg response
$15-$50 hourly rate
Pranay
(math1983)
Doctor of Philosophy (PhD)
Ph.D. in mathematics and working as an Assistant Professor in University. I can provide help in mathematics, statistics and allied areas.
4.6/5 (6,670+ sessions)
1 hour avg response
$40-$50 hourly rate
Leo
(Leo)
Doctor of Philosophy (PhD)
Hi! I have been a professor in New York and taught in a math department and in an applied math department.
4.9/5 (6,425+ sessions)
2 hours avg response

Similar Homework Solutions