Akhil Sharma has Published 671 Articles

Golang program to insert an element into a priority queue

Akhil Sharma

Akhil Sharma

Updated on 06-Jul-2023 16:05:15

128 Views

When working with go language there may be cases such as sorting, managing urgent events such as job scheduling, and more where you need to prioritize the element based on their urgency number. In this article, we will write a Go language program to insert an element into a priority ... Read More

Golang program of two struct types with identical fields, with having one "JSON" tag on each field

Akhil Sharma

Akhil Sharma

Updated on 06-Jul-2023 12:48:47

723 Views

Struct types are used to construct custom data structures consist of fields. These fields reflect the structure's characteristics or attributes. The ability to add tags to fields, such as "JSON" tags, which offer additional metadata about the field when serializing or deserializing the struct to/from JSON format, is a valuable ... Read More

How do you compare two struct instances that have pointers as fields in Golang

Akhil Sharma

Akhil Sharma

Updated on 06-Jul-2023 12:40:48

523 Views

In golang, Pointers are the variables which store the address of other variables. A struct is a counterpart to class in object-oriented programming where different fields can be placed in the struct, where these fields can be implemented later on and they have a type like int, float, string etc. ... Read More

Golang program to compare two instances of this struct for equality, taking into account the values in the slice

Akhil Sharma

Akhil Sharma

Updated on 06-Jul-2023 12:35:58

142 Views

A struct is a counterpart to class in object-oriented programming where different fields can be placed in the struct, where these fields can be implemented later on and they have a type like int, float, string etc.In this article, we will write a Go language program to compare the equality ... Read More

How to find the capacity of the pointers pointing at a map in Golang?

Akhil Sharma

Akhil Sharma

Updated on 06-Jul-2023 12:32:23

50 Views

A pointer is a variable which holds the address of another variable and can be used to point to the content of another variable. A pointer does not have its capacity just like slices, it can be used to point to the map whose length of elements can be calculated.In ... Read More

Golang program to find the longest path in a weighted directed acyclic graph using Bellman-Ford algorithm

Akhil Sharma

Akhil Sharma

Updated on 06-Jul-2023 12:30:54

289 Views

In this article, we will write a Go language program to find the longest path in a weighted directed acyclic graph using Bellman-ford-algorithm. Bellman-Ford-Algorithm is a popular algorithm used to find the longest path from source vertex to other vertices in a weighted directed graph. Syntax func range(variable) Any ... Read More

Golang program to find the minimum number of edges in a weighted directed graph that connects all nodes

Akhil Sharma

Akhil Sharma

Updated on 06-Jul-2023 12:24:12

89 Views

In this article, we will write Go language programs to find the minimum no. of edges in a weighted directed graph that connects all nodes. We will use Prim’s algorithm to perform this operation. It is a greedy algorithm which is used to find the minimum spanning tree for a ... Read More

Golang program to find the shortest path from a source node to a target node using the Bellman-Ford algorithm

Akhil Sharma

Akhil Sharma

Updated on 06-Jul-2023 12:22:17

99 Views

Bellman-ford algorithm is used to find the shortest distance from the source node to the other nodes in a weighted directed graph. This algorithm also predicts the negative weight cycles in the graph. It has a time complexity of O(V*E) where V stands for vertices and E stands for edges.In ... Read More

Golang program to implement radix sort for sorting floating-point numbers

Akhil Sharma

Akhil Sharma

Updated on 06-Jul-2023 12:15:36

224 Views

In this article, we will write Go language programs to implement radix sort for sorting floating-point numbers. Radix sort is usually used for sorting the integers, it can also be used to sort floating point numbers. It sorts items based on their particular bits or digits. This article provides an ... Read More

Golang program to implement radix sort for sorting strings

Akhil Sharma

Akhil Sharma

Updated on 06-Jul-2023 12:11:33

122 Views

Radix sort is efficient for sorting strings because of its inherent structure of string data type.In this article, we will write a Go language program to implement radix sort for sorting strings. We start working on an unsorted array string and demonstrate how radix sort can be applied to sort ... Read More

Advertisements