You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Furkan Türkal ad97178a8b update readme 7 years ago
..
resources update readme & added image 7 years ago
README.md update readme 7 years ago
linked-list-3-deleting-a-node.go updated and added find-length 7 years ago

README.md

LinkedList | SET 3 (DELETING A NODE) Source

What It Is

What It Is

We have discussed Linked List Introduction and Linked List Insertion in previous posts on singly linked list. Let us formulate the problem statement to understand the deletion process. Given a key, delete the first occurrence of this key in linked list.

To delete a node from linked list, we need to do following steps.

    1. Find previous node of the node to be deleted.
    1. Changed next of previous node.
    1. Free memory for the node to be deleted.
  • Input: Linked List = [7 -> 1 -> 3 -> 2]
  • Output: Created Linked List [2 -> 3 -> 1 -> 7]
  • Output: Linked List after Deletion of 1: [2 -> 3 -> 7]
  • Input: Position = 1, Linked List = [8 -> 2 -> 3 -> 1 -> 7]
  • Output: Linked List = [8 -> 3 -> 1 -> 7]
  • Input: Position = 0, Linked List = [8 -> 2 -> 3 -> 1 -> 7]
  • Output: Linked List = [2 -> 3 -> 1 -> 7]

Algorithm Complexity

Complexity Notation
Time Complexity O(1)