Akhil Sharma has Published 671 Articles

Haskell Program to calculate the Highest Common Factor

Akhil Sharma

Akhil Sharma

Updated on 01-Mar-2023 10:00:24

168 Views

This tutorial will help us in calculating the highest common factor using Haskell Programming. The highest common factor (HCF), also known as the greatest common divisor (GCD), is the largest positive integer that divides two or more integers without leaving a remainder. It is a measure of the largest positive ... Read More

Golang program to implement binary tree data structure

Akhil Sharma

Akhil Sharma

Updated on 22-Feb-2023 17:56:04

1K+ Views

In the Go, a binary tree is a tree data structure where each node has at most two children, as the left child and the right child. Go's built-in data structures and operations, like structs and pointers, can be used to create a binary tree. The tree's nodes can be ... Read More

Golang program to get current working directory

Akhil Sharma

Akhil Sharma

Updated on 22-Feb-2023 15:32:35

5K+ Views

Golang has a large range of internal packages to work with the directory. The directory in which the application is operating is known as the current working directory. Here we can use the OS packages as well as the path/filepath package of Golang to get current working directory. ... Read More

Golang program to create string from contents of a file

Akhil Sharma

Akhil Sharma

Updated on 22-Feb-2023 15:31:47

121 Views

In go we can use io and os package to perform various operations with file. In this article, we are going to use ioutil.readfile function to read the file and then the string function to convert the file data to string. From OS package we are going to use os.open ... Read More

Golang program to read and print all files from zip file

Akhil Sharma

Akhil Sharma

Updated on 22-Feb-2023 15:29:47

2K+ Views

Golang has packages like os, io, and Archie/zip that can be used to read and print all the files from a zipped file. A zip file is a compressed collection of a set of files/folders. The OS package is used for performing copy operations, the io pacakge is for reading ... Read More

Golang program to read the content of a file line by line

Akhil Sharma

Akhil Sharma

Updated on 22-Feb-2023 15:27:42

2K+ Views

In golang there are various internal packages such as bufio, os and io that can be used for reading the content of a file line by line. The bufio and os packages are used for opening and scanning the file using os.open and bufio.NewScanner function. The io package we are ... Read More

Golang program to get all files present in a directory

Akhil Sharma

Akhil Sharma

Updated on 22-Feb-2023 15:26:31

2K+ Views

Golang has OS package such as OS.open(), os.closs(), os.copy() and move more that are used for performing different operations with the external files. Similiary we have io package in golang that is used for performing read and write operations on the external file. Here in this article, we are going ... Read More

Golang program to append a string in an existing file

Akhil Sharma

Akhil Sharma

Updated on 22-Feb-2023 14:52:52

743 Views

In Golang, we can use io and os packages to append a string in an existing file. file contains data that can be manipulated in many ways like editing and writing the data. In this article the first method will demonstrate the application of os.Open file of OS package. ... Read More

Golang program to get the file extension

Akhil Sharma

Akhil Sharma

Updated on 22-Feb-2023 14:51:41

5K+ Views

In golang, we can use the path package and string package to get the extension of a particular file. Here, in his article, we will obtain the file extension using two methods. In the first method, we will use path package function path.Ext. In the second method, we will use ... Read More

Golang program to get the relative path from two absolute paths

Akhil Sharma

Akhil Sharma

Updated on 22-Feb-2023 14:50:38

4K+ Views

To get the relative path from two absolute paths in golang, we use filepath and string packages. Relative paths tell the location of file with respect to present working directory whereas absolute paths tell the location of file starting from root directory. In the first method we will use filepath ... Read More

Advertisements