Question: 7 . ( 1 point ) The following function is supposed lo insert a new node into its proper place in an ordered list, returning

7.(1 point) The following function is supposed lo insert a new node into its proper place in an ordered list, returning a pointer to the first node in the modified list. Unfortunately, the function doesn't work correctly in all cases. Explain what's wrong with it and show how to fix it.
```
struct node *insert_into_ordered_list(struct node *list, struct node *new_node)
{
struct node *cur = list, *prev = NULL;
while (cur->value = new_node->value){
prev = cur;
cur = cur->next;
}
prev->next = new_node;
```
Generated on 11/21/202422:05:12 EST
```
new_node->next = cur;
return list;
}
```
8.(1 point) Consider the following definition of node:
```
struct node {
int value;
struct node *next;
};
```
Write the following function: struct node *find_last(struct node *list, int n); The list parameter points to a linked list. The function should return a pointer to the last node that contains \( n \); it should return NULL if \( n \) doesn't appear in the list. Write a complete program to check your function. You must submit your complete solution code (.c file).
7 . ( 1 point ) The following function is

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!