Get Middle Element of Linked List in a Single Iteration using Golang

Akhil Sharma
Updated on 22-Feb-2023 13:54:59

314 Views

In golang data structures , a linked list has pointers connecting the items, and from the first node (head) to the last node, each node can be visited (tail) using next pointer. We will obtain the middle element of a linked list using two methods. The first approach depicts use of two-pointer approach and the second approach uses a counter variable to execute the program. Method 1: Using two-pointer approach In this method, the function navigates the linked list using two pointers, low and high. The high pointer takes two steps at a time, whereas the low pointer takes ... Read More

Golang Program to Implement Linked List

Akhil Sharma
Updated on 22-Feb-2023 13:53:47

414 Views

In Go programming language, a linked list is a linear data structure made up of a series of nodes which are linked to each other via next pointer, which points to the next address. We will implement linked list in this program using two methods. In the first method struct will be used and in the second example list struct will be used. Method 1: Using Struct In this method, there are three nodes in this linked list, and each one has a value of 1, 2, or 3. Each node's next pointer points to the node after it in ... Read More

Iterate Through Elements of Dictionary in Golang

Akhil Sharma
Updated on 22-Feb-2023 13:52:09

2K+ Views

In Golang, a dictionary is like a map which is a group of key-value pairs with a unique key for each value. The values can be of any type, and the keys can be of any type that is similar, such as strings or integers. We can build an empty map by using the built-in "make" function, and then add, retrieve, or update values. We will use two examples here to iterate through elements of a dictionary where in the first example loop will be used to iterate through the elements whereas in the next example slices will be used ... Read More

Use Different Types of Collection in Go

Akhil Sharma
Updated on 22-Feb-2023 13:50:27

1K+ Views

In Golang, a collection is a data structure that stores a number of elements, usually of the same type. The collection types in Go offers arrays, slices, maps, and channels. Slices are considered as dynamic arrays whose size can be changed whereas arrays have a fixed size. Channels give goroutines a method to communicate and synchronize their execution, whereas maps are used for key-value storage. Here, we will show execution of maps, slices and arrays using different ways as shown below in examples. Method 1: Using map, slice and array This method shows how to use arrays, slices, and maps ... Read More

Difference Between SEO and SMO

Kiran Kumar Panigrahi
Updated on 22-Feb-2023 13:00:04

3K+ Views

Both SEO and SMO are the methods used for driving traffic to a website, but they are quite different from each other. SEO (Search Engine Optimization) is a technique to enhance traffic on a site on the search engine result pages, whereas SMO (Social Media Optimization) is a technique to make the social media content visible to more users. Read this article to learn more about SEO and SMO and how they are different from each other. What is SEO? SEO is a technique to increase the ranking of a website on the search engine result pages. SEO is basically ... Read More

Difference Between SEO and SEM

Kiran Kumar Panigrahi
Updated on 22-Feb-2023 12:47:14

5K+ Views

SEO and SEM both are the techniques to increase the visibility and traffic on a website, however both are quite different from each other. The most basic difference between the two is that SEO focuses on enhancing the organic traffic on a website, while SEM uses different strategies to increase traffic like SEO, paid promotion, etc. Read this article to learn more about SEO and SEM and how they are different from each other. What is Search Engine Optimization (SEO)? Search Engine Optimization (SEO) is a way to increase the visibility of a website by nonpaid forms of advertising. It ... Read More

Difference Between Semaphore and Mutex

Kiran Kumar Panigrahi
Updated on 22-Feb-2023 12:44:01

3K+ Views

In operating systems, semaphore and mutex are two kernel resources that are used to provide synchronization services. A semaphore is an integer variable, while a mutex is an object. Read this article to learn more about semaphore and mutex and how they are different from each other. What is Semaphore? Semaphore is a signalling mechanism. It is basically an integer variable. A semaphore uses two operations, namely wait and signal for process synchronization. Therefore, the wait and signal operations can modify a semaphore. There are two types of semaphores namely, Counting Semaphore and Binary Semaphore. Counting Semaphore is the type ... Read More

Difference Between Row-Oriented and Column-Oriented Database

Kiran Kumar Panigrahi
Updated on 22-Feb-2023 12:41:27

5K+ Views

There are two ways of organizing data in a DBMS − one is row-oriented database and another is column-oriented database. The basic difference between the two is that a row-oriented database stores the data tables by rows, whereas a column-oriented database stores the data tables by columns. Read this article to learn more about row-oriented database and column-oriented database and how they are different from each other. What is Row-Oriented Database? A Roworiented database is a traditional database like Oracle, MySQL, etc. It stores data tables by rows and the common method of storing a table is to serialize each ... Read More

Reverse a Stack Using Queue

Sonal Meenu Singh
Updated on 22-Feb-2023 12:33:50

2K+ Views

Introduction Both Queue and Stack are linear data structures and are used to store data. Stack uses the LIFO principle to insert and delete its elements. A Queue uses the FIFO principle. In this tutorial, we will learn how to reverse a stack using Queue. Reversing means the last element of the Stack comes to first place and so on. What is Stack? The stack in the data structure is inspired by the stack in real life. It uses LIFO (Last In First Out) logic, which means the element that enters last in the Stack will be removed first. In ... Read More

Manage Full Circular Queue Event in C++

Sonal Meenu Singh
Updated on 22-Feb-2023 12:28:34

351 Views

Introduction Circular Queue is an improvement over a linear queue and it was introduced to address the memory wastage problem in the linear queue. A circular queue uses the FIFO principle for the insertion and removal of the elements from it. In this tutorial, we will discuss the operations of the circular queue and how to manage it. What is Circular Queue? A circular queue is another kind of queue in a data structure, whose front and rear ends are connected with each other. It is also known as Circular Buffer. Its operations are similar to the linear queue, so ... Read More

Advertisements