Hi, I am a college student taking C++ classes. I have some problems writing functions such as insert_head, insert_before, insert_after, where_this_goes, sorted_list, copy/clear, remove_node, search_node, and print_list with linked list. I hope that someone could help me out. Thank you.
i don't think anyone gets paid to answer queries here, just post your question, show some effort and highlight where exactly you're getting stuck (and use code-tags!)
also re insert_head etc you might also wish to search this forum (and other on-line), these are oft covered topics
This forum is full of people who are willing to help. Give your problems a try and ask about them here if you need help. This is a relatively beginner-friendly forum, as long as you put in some effort. We won't just do assignments for you, unless you get lucky.
The usual advice:
mbozzi wrote:
I strongly suggest that you ask for help publicly. This helps ensure the quality of the information you're getting (since it's usually examined by multiple people), and it makes the solution to your problem and the related discussion available to others who have the same issue.
If the offer is made, do not pay for help.
Edit: oops @gunnerfunner -- I didn't see your post.
This is what I have so far. I leave some functions in blank because I don't know how to do it. I understand the purpose of those functions, but I'm weak at the language syntax.
head_ptr is a variable local to _insert_head. Changing the value of head_ptr inside the function will have no effect outside of the function, so while line 6 isn't doing any harm it is entirely unnecessary.
The function is meant to be called like so, assuming head is of type Node* and is pointing to a valid object or contains a null value:
head = _insert_node(head, data_value);
Note that head will be changed when the function call is complete and the returned value is assigned to it.