- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
323 Views
ExamplesApproach to solve this problemStep 1 − Define a method that accepts the head of a linked list.Step 2 − If head == nil, create a new node and make it head and return it as the new head.Step 3 − When index == 0, then update the head.Step 4 − Iterate the given linked list from its head. Also, initialize preNode that will keep the store address of the previous node.Step 5 − If index i matches with the given index, then then delete that node.next, break the loop.Step 6 − Return, at the end of loop.Example Live Demopackage main ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
151 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 its head.Step 5 − If index i matches with the given index (to be deleted), then delete that node.next, break the loop.Step 6 − Return, at the end of the loop.Example Live Demopackage main import "fmt" type Node struct { value int next *Node } func NewNode(value int, next *Node) *Node{ var n ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
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 index i matches with the given index (to be deleted), then delete that node.next, break the loop.Step 6 − Return at the end of the loop.Example Live Demopackage main import "fmt" type Node struct { value int next *Node } func NewNode(value int, next *Node) *Node{ var n ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
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 i matches with the given index (to be deleted), then delete that node.next, break the loop.Step 6 − Return at the end of the loop.Example Live Demopackage main import "fmt" type Node struct { value int next *Node } func NewNode(value int, next *Node) *Node{ var n Node ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
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 with given index(to be delete) then delete that node.next, break the loop.Step 6 − Return, at the end of loop.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
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
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 − Traverse the Right sub-tree.Step 4 − Print the root node data.Example Live Demopackage main import "fmt" type Node struct { data int left *Node right *Node } func (root *Node)PostOrderTraversal(){ if root !=nil{ root.left.PostOrderTraversal() root.right.PostOrderTraversal() fmt.Printf("%d ", root.data) ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
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 i matches with the given index (to be updated), then update that node.Step 6 − Else, return 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 = ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
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 index i matches with the given index (to be updated), then update that node.Step 6 − Else, return 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 ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
70 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 i matches with the given index (to be updated), then update that node.Step 6 − Else, return 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 = ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
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 i matches with given index (to be updated), then update that node.Step 6 − Else, return the 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 = ... Read More