Akhil Sharma has Published 671 Articles

Golang program to create a temporary file

Akhil Sharma

Akhil Sharma

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

2K+ Views

In Go programming language we can use ioutil.TempFile function to create a temporary file. To create a new temporary file in the default temporary directory, this program uses the ioutil. TempFile function. The directory in which the file should be created is the first argument to TempFile, and the pattern ... Read More

Golang program to create a new file

Akhil Sharma

Akhil Sharma

Updated on 21-Feb-2023 12:12:31

4K+ Views

Golang has two internal function – os.create and ioutil.WriteFile to create a new file. The "file" is a disk-based file that a Go program may read from or write to. In Go, the OS can be used to represent a file. os package file type that offers ways to open, ... Read More

Golang program to convert file to byte array

Akhil Sharma

Akhil Sharma

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

12K+ Views

In Go programming language we can use byte function and ioutil.ReadFile function to convert a file into byte array. The os package file type that offers ways to open, read from, write to, and manipulate files whereas array is a fixed-size group of identical elements that may be accessed by ... Read More

Golang program to add elements to a linkedlist

Akhil Sharma

Akhil Sharma

Updated on 21-Feb-2023 12:09:50

1K+ Views

In Golang, we can use node struct and linkedlist struct to add elements to a linkedlist. A linkedlist is a data structure made up of a series of nodes, each of which includes an element and a reference to the node after it in the sequence. It is a linear ... Read More

Golang program to implement graph data structure

Akhil Sharma

Akhil Sharma

Updated on 21-Feb-2023 12:05:39

2K+ Views

In Go programming language, a graph is a type of data structure made up of a limited number of nodes (also known as vertices) and a set of connecting edges. Relationships between several entities can be depicted on a graph. It can be represented by employing different data structures, such ... Read More

Golang program to access elements from a linked list

Akhil Sharma

Akhil Sharma

Updated on 20-Feb-2023 16:17:00

254 Views

In Go Programming language, a linked list is a data structure which contains a node that further contains two values, the data and the next, where next points to the next node in the list. We will use two methods in this program to access elements from a linked list. ... Read More

Golang program to remove elements from the linked list

Akhil Sharma

Akhil Sharma

Updated on 20-Feb-2023 16:16:13

572 Views

In Go, a linked list is a linear data structure with pointers connecting the items, and from the first node (head) to the last node, each node can be visited (tail). We will execute the program of removing elements from the linked list using two examples. The first example uses ... Read More

Golang program to add elements at first and last position of linked list

Akhil Sharma

Akhil Sharma

Updated on 20-Feb-2023 16:14:56

197 Views

In golang, a linked list is a unique data structure in which there is a value in the node and the next pointer which points to the next node. The list's initial node is referred to as the head, while the list's last node which points to nil depicts the ... Read More

Golang program to implement the Queue data structure

Akhil Sharma

Akhil Sharma

Updated on 20-Feb-2023 16:13:46

2K+ Views

In this Golang program, a queue is a data structure that works on the First-In-First-Out (FIFO) principle where elements are added to the rear and removed from the front. Although Go doesn't come with a built-in queue data structure, slices, linked lists, and other data structures can be used to ... Read More

Golang program to implement stack data structure

Akhil Sharma

Akhil Sharma

Updated on 20-Feb-2023 16:12:44

4K+ Views

In Golang, a stack is a linear data structure that works on the Last-In-First-Out (LIFO) principle which means that the element which is pushed in the stack in last will be popped out first. We will use two methods to implement the stack data structure using slice of integers and ... Read More

Advertisements