- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 34470 Articles for Programming
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
173 Views
In this article, we will learn how to develop a golang program that takes a receiving channel as integer and sends a channel of strings. Here we will be using a concurrent approach that involves using the multiple goroutines to perform transformation concurrently as well as using select statements with timeout. Syntax channel_name := make(chan Type) To create a channel. channel_name
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
89 Views
Unidirectional channel is a type of channel that can only be used for either receiving or sending the data.In this article, we will create a golang program to detect a receiving channel that consist of string and a sending channel that has integers in it. Here we will learn how to utilize unidirectional channels to receive strings and send integers using unbuffered and buffered channels, select statements and using a struct to combine channels. Syntax ch := make(chan string) Creates a channel to handle strings. ch
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
233 Views
Unidirectional channel is a type of channel that will be either used for sending data or receiving data, but can’t be used for both. In this Golang article we will explore a Golang program that takes two unidirectional receiving channels and a sending channel using select statement as well as using a fan-in pattern method. We will provide code examples with algorithms and output of the code. Method 1: Using Select Statement This method allows you to handle multiple channel operations simultaneously and selecting the one which is ready to be processed. Algorithm Make three channels: channel one, channel ... Read More
Golang program to use a unidirectional channel to send integers from 1 to 10 to a receiving function
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
58 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 := make (chan int) To create an unbuffered channel Value :=
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
189 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 channel method, using interfaces as well as type conversion methods. Bidirection channels enables the channel data to be transferred and received. There may be times when you want to impose unidirectional communication, limiting either sending or receiving actions. Syntax ch := make(chan
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
122 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 an interface in go language with the help of various examples. Method 1: Single Method Interface The first method involves a single interface, in this approach we describe an interface that all implementing types must fulfill. Algorithm Create the interface with a single method called CreateSound(). Now, create ... Read More
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
110 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 priorities. In this article, we will write a Go language program to check if a priority queue is empty. Syntax func make ([] type, size, capacity) The make function in go language is used to create an array/map it accepts the type of variable to be created, its size ... Read More
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
100 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 leaves are taken as black If a node is red, both its children will be black Every path from a node to its descendant leaves contains the same number of black nodes Algorithm Create a "Node" struct with four fields: "key" of type int, "colour" of type string, ... Read More
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
263 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 is a challenge to find places where no two queens can attack each other. In this article, we will write a Go language program to implement the N queens problem. Syntax func make ([] type, size, capacity) The make function in go language is used to create an array/map ... Read More
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
74 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 a Red Black tree. It is a self-balancing Binary search tree with coloring properties where the root node is always black and other nodes are red or black as per the properties. This tree uses rotations to maintain the balance during insertions and deletions. Properties Every node is either ... Read More