Home > Back-end >  Singly linked list data structure to delete all the values for the elements of x
Singly linked list data structure to delete all the values for the elements of x

Time:06-09

Why isn't this the first element to delete to delete the value of the code I convert into 10 problems very great god who help look look have improved way of

CodePudding user response:

Because your p from phead - & gt; Next to the ah, you didn't calculate phead itself

CodePudding user response:

reference 1/f, not smell out the window of the reply:
because your p from phead - & gt; Next to the ah, you didn't calculate phead itself?

Thank you for your answer so how should improve

CodePudding user response:

Because there is no comparison in the first node, look at the p initialized to head the next node,

The original poster can judge a head node first and then behind the judgment of the node

CodePudding user response:

refer to the second floor Christopher__ response:
Quote: refer to 1st floor not smell out the window of the reply:
because your p from phead - & gt; Next to the ah, you didn't calculate phead itself?

Thank you for your answer so how to improve it

Change q=p to q=phead should be ok

CodePudding user response:

refer to the second floor Christopher__ response:
Quote: refer to 1st floor not smell out the window of the reply:
because your p from phead - & gt; Next to the ah, you didn't calculate phead itself?

Thank you for your answer so how to improve it

Better way is to get a head pointer, you don't store content, also is your head not to put data, simple is a pointer to a linked list, it would have been better

CodePudding user response:

reference 3 building self-confidence boy reply:
because there is no comparison in the first node, see p initialized to head the next node,

The original poster can judge a head node first and then at the back of the judgment of node

I judge the structure or wrong

CodePudding user response:

reference 1/f, not smell out the window of the reply:
because your p from phead - & gt; Next to the ah, you didn't calculate phead itself?

Defines the phead=NULL in the rear

CodePudding user response:

refer to 6th floor Christopher__ response:
Quote: refer to the third floor confident boy reply:
because there is no comparison in the first node, see p initialized to head the next node,

The original poster can judge a head node first and then at the back of the judgment of node

I judge the structure or wrong

It depends on how you judge the ~
Post code ~

CodePudding user response:


I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10581430.html
I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10768339.html
  • Related