Akhil Sharma has Published 671 Articles

Golang program to iterate hash collection and print only values

Akhil Sharma

Akhil Sharma

Updated on 03-Apr-2023 13:23:09

227 Views

In golang we can use hashmap and key functions to iterate hash collection. Hashmap is said to be one of the hash collections. In the hashmap the data is stored in key value pairs as we did below. In this program we will use three methods to iterate the hashmap ... Read More

Golang program to get the current weekday

Akhil Sharma

Akhil Sharma

Updated on 03-Apr-2023 13:22:12

256 Views

In this Go language article, we will write proCurrent weekday implies the current day in the week which can be obtained using numerous methods. In this program we will use three examples to get the current weekday for which time package will be imported in the program, it helps in ... Read More

Golang program to get current time zone

Akhil Sharma

Akhil Sharma

Updated on 03-Apr-2023 13:19:11

4K+ Views

Golang has internal functions like Now() Time, and other Time functions that can be used for getting the current time zone. Current time zone in Go is a time zone where people reside in and see the same standard time. In a country like India IST is observed throughout the ... Read More

Golang program to create a hash collection

Akhil Sharma

Akhil Sharma

Updated on 03-Apr-2023 13:18:29

143 Views

In this article, we will write a Golang programs to create hash collections with the help of make function and map function. Hashmap stores key value pairs that can be accessed via index. In this program we will create a hash collection with the help of two examples. Syntax func ... Read More

Golang program to demonstrate a simple module

Akhil Sharma

Akhil Sharma

Updated on 03-Apr-2023 13:17:34

101 Views

In this Go language article, we will write programs to demonstrate a simple module. A module in Go is called as the collection of packages namely we can call it packages and sub-packages where the root file will be called as go.mod. In this program we will demonstrate a module ... Read More

Golang program to perform binary search on a slice of custom structs

Akhil Sharma

Akhil Sharma

Updated on 03-Apr-2023 13:14:13

689 Views

In this Golang article, we are going to perform binary search on a slice of custom structs using iterative and recursive method. Binary search is a search algorithm used to find the position of a specific value within a sorted sequence of elements. Algorithm Step 1 − First, we ... Read More

Golang program to check if a stack is empty

Akhil Sharma

Akhil Sharma

Updated on 03-Apr-2023 13:13:45

155 Views

In this Golang article, we are going to check if a stack is empty using iterative and recursive method. A stack is a linear data structure that follows the Last-In-First-Out (LIFO) principle. Algorithm Step 1 − First, we need to import the fmt and strconv package. Step 2 − ... Read More

Golang program to reverse a stack

Akhil Sharma

Akhil Sharma

Updated on 03-Apr-2023 13:13:14

152 Views

In this Golang article, we are going to reverse a stack using recursive and iterative method. A stack is a linear data structure that follows the Last-In-First-Out (LIFO) principle. Algorithm Step 1 − First, we need to import the fmt and strconv package. Step 2 − Create a stack ... Read More

Golang program to find if there exists a pair of numbers in an array that add up to a given target sum using two pointer approach

Akhil Sharma

Akhil Sharma

Updated on 03-Apr-2023 13:12:40

223 Views

In this Golang article, we are going to find if there exists a pair of numbers in an array that add up to a given target sum using two pointer approach with iterative and optimized-iterative method. An array is a collection of elements of the same data type, arranged in ... Read More

Golang program to find longest subarray with a given sum using two-pointer approach

Akhil Sharma

Akhil Sharma

Updated on 03-Apr-2023 13:12:02

197 Views

In this Golang article, we are going to find longest subarray with a given sum using two-pointer approach with iterative and optimized-iterative method. An array is a collection of elements of the same data type, arranged in a contiguous block of memory, and accessed using an index or a subscript. ... Read More

Advertisements