In this tutorial, we will write a go language program to remove duplicate elements from an array. By removing the duplicate entries, we mean that we wish to remove a value repeating multiple times. In this tutorial, we are using examples of an array of integers as well as an array of strings. Method 1: Remove Duplicate Values from an Array using an External Function The following code illustrates how we can remove duplicate values from an array of integers using a user-defined function. Algorithm Step 1 − First, we need to import the fmt package. Step 2 − ... Read More
In this tutorial, we will see to write a go language program to calculate the average of numbers using arrays. We are creating two programs in this example. In the first method, we are using a user-defined function to calculate the average while in the second one we are using an internal go function to find the same. Method 1: Calculate the Average of Numbers using Arrays In this method, we will create a separate function and pass the array to it. The function accepts the array as an argument and then after calculating the average it returns the ... Read More
In this tutorial, we will write a go language program to multiply two matrices by passing them to a function. In order to achieve this result, we will use both single dimension and multi-dimensional matrices. The difference between a single-dimension array and a multidimensional matrix is that the former has the same order while the latter has a different order of rows and columns. Method 1: Multiply Two Matrices of the Same Order by Passing them to a Function In this method, we will see to multiply two matrices of the same order bypassing the matrix to a user-defined function ... Read More
In this tutorial, we will write a go language program to multiply two matrices. The difference between a single-dimensional array and a multi-dimensional array is that the former holds an attribute while the latter holds another array on the index. Additionally, every element of a multidimensional array will have the same data type. Method 1: Multiply Two Matrices using Multi-Dimensional Arrays in the Main Function In this method, we will write a golang program to multiply two Multi-dimensional matrices using for loops in the main() function. Algorithm Step 1 − Import the fmt package. Step 2 − Now, ... Read More
Insertion sort is defined as an In-Place Algorithm and it is declared as a stable algorithm. The idea of sorting an array in ascending or descending order by swapping an element can be used to implement Insertion Sort. For instance, if the array contains only one item in the list, then it is considered sorted. Otherwise, we consider that a certain portion of the list of elements is sorted while other is unsorted. Proceeding with this assumption, we traverse through the unsorted list, picking one element at a time. Syntax rand.Seed(value) Rand.Seed() function is used to generate random ... Read More
In this tutorial, we will write a go language program to iterate over each element of the array. An array is a data structure that is used to store data at contiguous memory locations. There are many methods to iterate over an array. The simplest one is to use a for loop. Here, we will see how we can iterate over the integer and string types of arrays using various methods in go. Method 1: Iterate over the Array using For Loop In this method, we will write a go language program to iterate over the array using for loops. ... Read More
In this article, we will write a go language program to find the transpose of a matrix. A matrix is a collection of numbers arranged in rows and columns, a two-dimensional array. Transpose of a matrix is defined as a matrix obtained by interchanging the rows and columns of that matrix. Method 1: Find the Transpose of a Matrix using For Loop In this example, we will write a go language program to find the transpose of the matrix using for loops in the main function. Algorithm Step 1 − Import the fmt package. Step 2 − Call the main() ... Read More
In this article, we will write a go language program to print the upper triangular matrix of any given matrix. Introduction − A square matrix is called an upper triangular matrix if it has zero values below the principal diagonal. A matrix is displayed in its upper triangular form only if it is square. i.e. it must have the same number of rows and columns. The order of a typical upper triangular matrix is N X N. Method 1: Display Upper Triangular Matrix using For Loops In this method, we will write a go language program to display upper ... Read More
In this article, we will write a go language program to remove duplicates from an array. To achieve this we will be using two approaches. In the first one, we will use the array of strings, and in the second one; we will be using an array of integers. Method 1: Remove Duplicates from an Array of Strings using The Make() Function In this example, we will write a go language program to remove duplicates from the array of strings using a user-defined function. The function will accept the array of strings as an argument and will return the final ... Read More
Ethernet is a set of protocols that are used primarily in LANs, although they can also be used in larger networks like MANs and even WANs. Ethernet was first standardized in the 1980s as the IEEE 802.3 standard. Since then, it has seen several upgrades and its data carrying capacity kept increasing with each upgrade. Standard Ethernet can support data speeds up to 10 Mbps. Fast Ethernet can carry data at a maximum speed of 100 Mbps. With Gigabit Ethernet, the data speeds reached a maximum speed of 1 Gbps. 10-Gigabit-Ethernet can carry data at incredibly high speeds of ... Read More