Found 34494 Articles for Programming

Golang program to implement a treap

Akhil Sharma
Updated on 05-Sep-2023 18:46:19

73 Views

In this article, we will explore the implementation of a Treap data structure in Golang using two different methods. A Treap is a combination of a binary search tree and a binary heap, making it an efficient data structure for maintaining a set of ordered elements while also ensuring balanced priority. The first method will utilise a recursive approach for building and maintaining the Treap, while the second method will implement an iterative approach. The examples below showcase the creation and traversal of a randomised binary search tree, Explanation A Treap is a cool combination of two other structures, a ... Read More

Golang program to implement a bitset

Akhil Sharma
Updated on 05-Sep-2023 18:08:26

185 Views

A BitSet is a data structure that represents a fixed-size set of binary values, where each value can be either 0 or 1. It is commonly used for efficiently storing and manipulating large sets of boolean values. In this article, we will implement a bitset in go, using two different methods, the first one involves the use of slice of booleans as well as the second one involves using bit manipulation with unsigned integers. Implementation here means that we are going to perform various operations like setting, clearing and testing of individual bits within a bitset data structure. Explanation ... Read More

Golang program to implement a trie with compressed nodes

Akhil Sharma
Updated on 05-Sep-2023 17:57:26

105 Views

Tries are tree-like data structures used for efficient storage and retrieval of strings, making them invaluable for tasks like autocomplete, dictionary implementation, and pattern matching. The compressed node technique optimises space usage by merging common prefixes among nodes, resulting in a more memory-efficient Trie. In this article, we will explore the implementation of a Trie with Compressed Nodes in Golang using two methods to implement the Trie with Compressed Nodes, the first method utilises maps, and the second method uses arrays. Explanation A compressed trie is a trie data structure that saves the space by combining consecutive nodes with ... Read More

Golang program to implement a double ended priority queue

Akhil Sharma
Updated on 05-Sep-2023 17:54:25

114 Views

A Double Ended Priority Queue, in short DEPQ is a data structure that extends the functionality of a standard priority queue. In this article, we will implement a double ended priority queue in Golang using two methods: the first method uses two separate heaps for maximum and minimum priorities, while the second method augments a single heap with additional information for efficient queries. In the code examples we are going to perform the operations like insertion retrieval, deletion and updation. Explanation Double ended priority queue is a data structure that allows insertion and deletion operations and it allows efficient ... Read More

Golang program to implement a hash table with linear probing

Akhil Sharma
Updated on 05-Sep-2023 17:44:25

358 Views

Hash tables are efficient data structures used to store key-value pairs, making them essential for various applications. Linear probing is a collision resolution technique that helps handle situations when two keys map to the same index in the hash table. In this article, we will explore the implementation of a Hash Table with Linear Probing in Golang, using arrays and maps, gaining insights into their workings and practical applications. In the below examples we are going to perform insertion and retrieval operations using a hash mechanism and collision resolution strategy. Explanation In the below example, keys [10 , 25, ... Read More

Golang program to implement a deque using doubly linked list

Akhil Sharma
Updated on 05-Sep-2023 17:39:12

202 Views

A deque is a versatile data structure that allows insertion and deletion of elements from both ends efficiently. The doubly linked list provides an excellent foundation for building a deque as it allows easy traversal in both directions. In this article, we will explore deque using doubly linked lists in go with two methods: using a custom doubly linked list and using the built-in container/list package in Golang. Here in the below examples we will showcase the operations of a double ended queue, we will perform the insertion and deletion operations at both the ends. Explanation As you can see ... Read More

What is Color Histogram Equalization in MATLAB?

Manish Kumar Saini
Updated on 06-Sep-2023 16:01:03

143 Views

In digital image processing, there is a technique called histogram equalization which is used to enhance the visual quality of an image by manipulating contrast in the image. Histogram equalization improves the quality of an image by redistributing the pixel values across the entire image, so that the histogram of the image can be uniformly distributed. Histogram is nothing but the frequency of occurrence of each pixel intensity value. Sometimes, we see that the pixel intensities in an image are concentrated in a particular range and results in the poor visual quality of the image. Histogram equalization is used to ... Read More

What are different types of denoising filters in MATLAB?

Manish Kumar Saini
Updated on 06-Sep-2023 16:00:05

144 Views

In MATLAB, a denoising filter is a tool that can reduce or remove noise from a digital image or a digital signal. As we know, noise is an unwanted signal or disturbance in a digital signal that impacts the quality of the signal or can cause errors in the signal processing. Therefore, it is required to remove or reduce the noise in a signal or image. This can be done with the help of a denoising filter. In this tutorial, we will explore several different types of denoising filter in MATLAB and will implement them using MATLAB programming. Types of ... Read More

Trapezoidal numerical integration in MATLAB

Manish Kumar Saini
Updated on 06-Sep-2023 15:58:09

173 Views

In mathematics, trapezoidal numerical integration is a method of approximating the definite integral of a function over a certain interval. In the trapezoidal numerical integration, a curve is divided into multiple trapezoids and then areas of all the trapezoids are calculated and added to estimate the total area under the curve. It is a basic method for approximating the definite integral of a function. Hence, it is not much accurate as the other advanced integration methods. However, for simple functions, this method can provide a reasonable approximation. Trapezoidal Numerical Integration Using MATLAB In MATLAB, we have a built-in function 'trapz' ... Read More

How To Create Video from Sequence of Images Using MATLAB?

Manish Kumar Saini
Updated on 06-Sep-2023 15:57:07

90 Views

In MATLAB, we can create a video from a sequence of images. In this tutorial, we will explore the steps involved in creating a video from an image sequence and will take an example to understand the concept practically. Process of Creating Video From a Sequence of Images The step-by-step process of creating a video from a sequence of images is explained below − Step (1) − Firstly, collect all the images in a folder that we want to use in the video. Step (2) − Read all the images using the 'imread' function and store them in a ... Read More

Advertisements