Deleting a middle node from a single linked list when pointer to the previous node is not available

前端 未结 24 1339
陌清茗
陌清茗 2020-11-29 20:42

Is it possible to delete a middle node in the single linked list when the only information available we have is the pointer to the node to be deleted and not the pointer to

24条回答
  •  醉梦人生
    2020-11-29 21:05

    Yes, but your list will be broken after you remove it.

    In this specific case, traverse the list again and get that pointer! In general, if you are asking this question, there probably exists a bug in what you are doing.

提交回复
热议问题