Min heap implementation - C++

I have discussed the priority queue and implementations of queue, vector. Now, we are gonna discuss about min heap, also known as a priority queue. So, what’s this data structure? It has 4 main methods: size() - returns the number of the elements front() - return the current minimum element pop() - deletes the current minimum element push(element) - insert new element to the heap How do we implement this?...

October 13, 2023 · 4 min · 839 words · Me

Dynamic array implementation - C++

We discussed queue implementation in here and about vector here. Like a queue we will now discuss vector implementation in this post. A vector is a simple data structures similar to an array, but its size is dynamic. The main feature is that we can access any element in vector in O(1) time. Vector has three main methods size() - returns the number of elements. push(element) - inserts a new element at the back of the vector....

October 4, 2023 · 6 min · 1088 words · Me

Queue implementation - C++

We talked about queue in this post. Now, I’m gonna explain how to implement this data structure. What we need is a basic understanding of pointer and memory. Queue has 4 main methods size() - returns the number of the elements top() - returns the first element of the queue pop() - deletes the first element push(element) - insert new element back of the queue How hard can it be?...

September 24, 2023 · 4 min · 729 words · Me

Union Find

About the Disjoint Set Union (Union Find) data structure: Judging by its name, the data structure consists of three words: union, find, and disjoint. There are three main operations or concepts associated with it. Determining to which part it belongs Union, which involves combining two separate parts. The structure has two actions. Initially, we start with multiple separate parts and the goal is to connect them easily while being able to determine to which part it belongs....

May 14, 2023 · 4 min · 698 words · Me