Akhil Sharma has Published 671 Articles

Golang Program to Get the middle element of LinkedList in a single iteration

Akhil Sharma

Akhil Sharma

Updated on 22-Feb-2023 13:54:59

178 Views

In golang data structures , a linked list has pointers connecting the items, and from the first node (head) to the last node, each node can be visited (tail) using next pointer. We will obtain the middle element of a linked list using two methods. The first approach depicts ... Read More

Golang program to implement linked list

Akhil Sharma

Akhil Sharma

Updated on 22-Feb-2023 13:53:47

239 Views

In Go programming language, a linked list is a linear data structure made up of a series of nodes which are linked to each other via next pointer, which points to the next address. We will implement linked list in this program using two methods. In the first method struct ... Read More

Golang Program to Iterate through Elements of Dictionary

Akhil Sharma

Akhil Sharma

Updated on 22-Feb-2023 13:52:09

1K+ Views

In Golang, a dictionary is like a map which is a group of key-value pairs with a unique key for each value. The values can be of any type, and the keys can be of any type that is similar, such as strings or integers. We can build an empty ... Read More

Golang program to use different types of a collection

Akhil Sharma

Akhil Sharma

Updated on 22-Feb-2023 13:50:27

832 Views

In Golang, a collection is a data structure that stores a number of elements, usually of the same type. The collection types in Go offers arrays, slices, maps, and channels. Slices are considered as dynamic arrays whose size can be changed whereas arrays have a fixed size. Channels give goroutines ... Read More

Golang program to join two linked list

Akhil Sharma

Akhil Sharma

Updated on 22-Feb-2023 11:12:10

326 Views

In Go, a linked list is a linear data structure that contains a node which further contains two fields one is data and the other one is next. The next contains the address of the next node in continuation. We will execute this program with the help of two methods. ... Read More

Golang program to perform inorder tree traversal

Akhil Sharma

Akhil Sharma

Updated on 21-Feb-2023 12:18:30

465 Views

In Go programming language, a tree is a frequently used data structure that resembles an upside-down tree or an inverted tree with parent-child relationships between the nodes. In a tree, each node has a value and zero to many nodes as offspring. The root node is the node without a ... Read More

Golang program to convert the arraylist into string and vice-versa

Akhil Sharma

Akhil Sharma

Updated on 21-Feb-2023 12:17:44

395 Views

In go we can use strings.Join to convert a arraylist into string. Here we will understand how we can use strings.Join to combine multiple texts from an array that are separated by commas and spaces also, strings. To create an array of strings, use the Split function on the string. ... Read More

Golang program to convert a linked list into an array and vice-versa

Akhil Sharma

Akhil Sharma

Updated on 21-Feb-2023 12:16:29

278 Views

In the Go programming language, a linkedlist is a data structure made up of a series of nodes, each of which has a value and a reference (pointer) to the node after it. Since items can be added to or removed from a list without rearranging the entire data set, ... Read More

Golang program to make a file read-only

Akhil Sharma

Akhil Sharma

Updated on 21-Feb-2023 12:15:32

1K+ Views

We can use chmod function and syscall package in Golang to make a file read-only file. To convert a file into read-only files, the chmod function set the file’s right to 044. The os.Chmod function is then used to modify the file's mode. In syscall package of Golang we are ... Read More

Golang program to write into a file

Akhil Sharma

Akhil Sharma

Updated on 21-Feb-2023 12:14:20

4K+ Views

In go programming language we can use os.create and ioutil.WriteFile to write into a file. In Go, the OS can be used to represent a file. os package file type that offers ways to open, read from, write to, and manipulate files. Method 1: Using os.Create function We make use ... Read More

Advertisements