Akhil Sharma has Published 671 Articles

Golang program to use a unidirectional channel to send integers from 1 to 10 to a receiving function

Akhil Sharma

Akhil Sharma

Updated on 05-Jul-2023 18:29:35

56 Views

In this go language article we are going to use a unidirectional channel to send integers from 1 to 10 to a receiving channel. We will be using a basic channel, a buffered channel with fixed capacity as well as using a select statement for non-blocking channel operation. Syntax ch ... Read More

How do you create unidirectional channels in Golang?

Akhil Sharma

Akhil Sharma

Updated on 05-Jul-2023 17:37:50

180 Views

When working with go language channels there must be cases such as clear communication intent, enhanced safety in communication, encapsulation and more where you need to create unidirectional channels. In this go language article we are going to learn to create unidirectional channels using send only channel method, receive only ... Read More

How do you declare an interface in Golang?

Akhil Sharma

Akhil Sharma

Updated on 05-Jul-2023 17:31:12

118 Views

Declaring an interface in go language means creating a new named type that defines a collection of method signatures. In go-language we can declare an interface using single method interface, multiple method interface as well as embedded interface. In this article we are going to understand these methods and declare ... Read More

Golang program to check if a priority queue is empty

Akhil Sharma

Akhil Sharma

Updated on 05-Jul-2023 17:28:40

107 Views

A priority queue is a queue in which elements are stored along with their priority values. The functions supported by priority queue are − enqueue and dequeue where enqueue implies adding elements to the queue along with their priorities and dequeue implies removing elements from the queue along with their ... Read More

Golang program to insert a new node into a Red Black Tree

Akhil Sharma

Akhil Sharma

Updated on 05-Jul-2023 17:25:28

98 Views

In this article, we will write a Go language program to insert a node into a Red Black tree. A Red Black tree. It is a self-balancing Binary search tree having the following properties − Every node is either red or black The root node is always black All ... Read More

Golang program to implement N queens problem

Akhil Sharma

Akhil Sharma

Updated on 05-Jul-2023 17:23:29

257 Views

N queen problem is a puzzle in which N queens are to be placed on a NXN chessboard, so that the two queens don’t share the same row, column and diagonal or attack each other. A queen in chess can move in any direction, horizontally, vertically and diagonally so it ... Read More

Golang program to search for a node in a Red Black Tree

Akhil Sharma

Akhil Sharma

Updated on 05-Jul-2023 17:20:10

72 Views

Searching a node in a red black tree is to find a node with a specific key or value. The search in the red black tree is similar to searching in a standard binary tree. In this article, we will write Go language programs to search for a node in ... Read More

Golang program to insert an element into a binary heap

Akhil Sharma

Akhil Sharma

Updated on 05-Jul-2023 17:00:47

136 Views

Inserting an element in a binary heap means to add an extra element to the heap and maintain the heap property at the same time.In this Go language article, we will write a program to insert an element into a binary heap. It is a binary tree-based data structure which ... Read More

Golang program to represent a Binary Heap

Akhil Sharma

Akhil Sharma

Updated on 05-Jul-2023 16:57:52

289 Views

A Binary heap is a binary tree-based data structure which is used to implement priority queues and sorting algorithms. In this article, we will write a Go language program to represent a Binary Heap. There are two types of heaps: max and min heap. In max heap the value of ... Read More

Golang program to define a Red Black tree

Akhil Sharma

Akhil Sharma

Updated on 05-Jul-2023 16:51:54

255 Views

In go language we can create a red black tree by providing proper structures and methods. In this article we will write Go language programs to define a Red Black tree. Here, the root node is always black and other nodes can be red or black based on the properties ... Read More

Advertisements