Rishikesh Kumar Rishi has Published 1162 Articles

Golang program to delete the ith index node, when the index is the last index in the linked list.

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 18-Mar-2021 11:55:37

59 Views

ExamplesApproach to solve this problemStep 1 − Define a method that accepts the head of a linked list.Step 2 − If head == nil, return the head.Step 3 − When index == 0, then return head.nextStep 4 − Else, iterate the given linked list from its head.Step 5 − If ... Read More

Golang program to delete the ith index node, when the index is at the mid-index level in the linked list.

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 18-Mar-2021 11:53:28

64 Views

ExampleApproach to solve this problemStep 1 − Define a method that accepts the head of a linked list.Step 2 − If head == nil, return the head.Step 3 − When index == 0, then return head.nextStep 4 − Else, iterate the given linked list from head.Step 5 − If index ... Read More

Golang Program to delete the ith index node, when the index is at 0th position in the linked list.

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 18-Mar-2021 11:50:13

68 Views

ExamplesApproach to solve this problemStep 1 − Define a method that accepts head of the linked list.Step 2 − If head == nil, return the head.Step 3 − When index == 0, then return head.nextStep 4 − Else, Iterate given linked list from head.Step 5 − If index i matches ... Read More

Golang Program to traverse a given tree in Postorder Traversal (Recursive).

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 18-Mar-2021 11:46:29

244 Views

ExampleSuppose we have the following binary tree.Postorder Tree Traversal Output − 2 4 5 3 6 7 1.Approach to solve this problemStep 1 − If the root node of the given tree is nil, then return; else, follow the steps given below.Step 2 − Traverse the Left sub-tree.Step 3 − ... Read More

Golang program to update the ith index node value, when index is at the nth position, i.e., out of index bound.

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 18-Mar-2021 11:44:32

48 Views

ExampleApproach to solve this problemStep 1 − Define a method that accepts the head of a linked list.Step 2 − If head == nil, return the head.Step 3 − Initialize the index as i := 0.Step 4 − Iterate the given linked list from its head.Step 5 − If index ... Read More

Golang program to update the ith index node value, when the index is at 2, i.e., mid index.

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 18-Mar-2021 11:42:49

60 Views

ExamplesApproach to solve this problemStep 1 − Define a method that accepts the head of a linked list.Step 2 − If head == nil, return the head.Step 3 − Initialize the index as i := 0.Step 4 − Iterate the given linked list from its head.Step 5 − If the ... Read More

Golang Program to update the ith index node value, when index is at the last index.

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 18-Mar-2021 11:38:18

71 Views

ExampleApproach to solve this problemStep 1 − Define a method that accepts the head of a linked list.Step 2 − If head == nil, return the head.Step 3 − Initialize the index as i := 0.Step 4 − Iterate the given linked list from its head.Step 5 − If index ... Read More

Golang Program to update the ith index node value, when index is at 0 index.

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 18-Mar-2021 11:36:29

67 Views

ExamplesApproach to solve this problemStep 1 − Define a method that accepts the head of a linked list.Step 2 − If head == nil, return the head.Step 3 − Initialize the index as i := 0.Step 4 − Iterate the given linked list from its head.Step 5 − If index ... Read More

Golang program to insert a new node after the Kth node (K is not in the linked list)

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 18-Mar-2021 06:54:51

70 Views

ExampleAdd node 15 after 50((K is not in the linked list)) value node.Approach to solve this problemStep 1 − Define a method that accepts the head of a linked list.Step 2 − If head == nil, return the head.Step 3 − Iterate the given linked list.Step 4 − If node ... Read More

Golang Program to delete the node after the Kth node (K is not in the linked list).

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 18-Mar-2021 06:38:28

68 Views

ExamplesDelete node after 50(K is not in the linked list) value node.Approach to solve this problemStep 1 − Define a method that accepts the head of a linked list.Step 2 − If head == nil, return the head.Step 3 − Iterate the given linked list.Step 4 − If node value ... Read More

Advertisements