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

Basic data structure

C++ has many simplified data structures that we don’t need to write ourselves, and let’s talk about them. At first, I will write about what they do, what their structure is, and then I think I will write the code for all of them myself and how they work. Array About Array. An Array can be thought of as a container that can hold many things. Currently we only store 1 value in 1 variable, so what if we need to store 2000 variables?...

April 4, 2023 · 9 min · 1769 words · Me