
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 1082 Articles for Go Programming

112 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 value 50 is not found, return the head without adding any node.Example Live Demopackage main import ( "fmt" ) type Node struct { value int next *Node } func NewNode(value int, next *Node) *Node{ var n Node n.value = value n.next = next return ... Read More

118 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 50 is not found, return the head without deleting any node.Example Live Demopackage main import "fmt" type Node struct { value int next *Node } func NewNode(value int, next *Node) *Node{ var n Node n.value = value n.next = next return &n } func TraverseLinkedList(head ... Read More

92 Views
ExamplesUpdate node after k=50 value nodeApproach 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 10 is not found, return the head without updating any node.Example Live Demopackage main import "fmt" type Node struct { value int next *Node } func NewNode(value int, next *Node) *Node{ var n Node n.value = value n.next = next return &n } func TraverseLinkedList(head *Node){ temp := head ... Read More

124 Views
ExamplesUpdate node after k=10 value nodeApproach 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 temp.value is 10, then update temp.next.value=data.Step 5 − If node value 10 is not found, return the head without updating any node.Example Live Demopackage main import "fmt" type Node struct { value int next *Node } func NewNode(value int, next *Node) *Node{ var n Node n.value = value n.next = next return &n ... Read More

123 Views
ExamplesDelete node after 10 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 temp.value is 10, then override that node’s next value with its next node’s next value.Step 5 − If node value 10 is not found, return the head without deleting any node.Example Live Demopackage main import "fmt" type Node struct { value int next *Node } func NewNode(value int, next *Node) *Node{ var n Node n.value ... Read More

129 Views
ExamplesAdd node 15 after 10 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 temp.value is 10, then add the node 15 as the next node.Step 5 − If node value 10 is not found, return the head without adding any node.Example Live Demopackage main import "fmt" type Node struct { value int next *Node } func NewNode(value int, next *Node) *Node{ var n Node n.value = value ... Read More

284 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 − Else, update the last node value to 41.Example Live Demopackage main import "fmt" type Node struct { value int next *Node } func NewNode(value int, next *Node) *Node{ var n Node n.value = value n.next = next return &n } func TraverseLinkedList(head *Node){ temp := head for temp != nil { fmt.Printf("%d ", temp.value) temp = temp.next ... Read More

224 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 − Else, update the first node value to 29.Example Live Demopackage main import "fmt" type Node struct { value int next *Node } func NewNode(value int, next *Node) *Node{ var n Node n.value = value n.next = next return &n } func TraverseLinkedList(head *Node){ temp := head for temp != nil { fmt.Printf("%d ", temp.value) temp = temp.next ... Read More

449 Views
ExamplesApproach to solve this problem −Step 1 − Define a method that accepts the head of a linked list.Step 2 − If head == nil, return the head.Step 3 − Go to the next node and return the updated head.Example Live Demopackage main import ( "fmt" ) type Node struct { value int next *Node } func NewNode(value int, next *Node) *Node{ var n Node n.value = value n.next = next return &n } func TraverseLinkedList(head *Node){ temp := head for temp != nil { fmt.Printf("%d ", temp.value) ... Read More

618 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 − Go to the next node and return the updated head.Example Live Demopackage main import "fmt" type Node struct { value int next *Node } func NewNode(value int, next *Node) *Node{ var n Node n.value = value n.next = next return &n } func TraverseLinkedList(head *Node){ temp := head for temp != nil { fmt.Printf("%d ", temp.value) temp = ... Read More