Home

Binary Search

Introduction to Binary Search: Binary Search is defined as a searching algorithm used in a sorted array by repeatedly dividing the search interval in half. The Idea of Binary search is to use the information that the array is sorted and reduce the time complexity to $O(log N)$. It a powerful tool in various problems as it can be used in a vers...

Read more

Stack

Introduction to Stack: Stack is a LIFO (Last In First Out) data structure i.e., the element that was inserted last will be removed first. A stack is a linear data structure that provides two O(1) time operations: adding an element to the top, and removing an element from the top. It is only possible to access the top element of a stack. ...

Read more

Queue

Introduction to Queue: A queue is a linear data structure that follows the FIFO (First In First Out) principle. This means that the element which is inserted first will be the one to be removed first. Think of it like a queue of people waiting for a bus to go to a particular destination, where the person who arrived first gets on the bus first and ...

Read more

Vectors

# Introduction to Vectors: Vectors are the same as dynamic arrays with the ability to resize themselves automatically when an element is inserted or deleted, with their storage being handled automatically by the container. It is defined inside the header file. Syntax to declare vector in c++ std::vector<data_type> vector_name; where ...

Read more

Maps

Introduction to Maps: In C++, a “map” is a data structure that stores a collection of key-value pairs. It’s like having a dictionary where you can look up a word (the key) and find its definition (the value). Some key points related to maps In C++, the map is a type of associative container that stores elements formed by a combination of a ke...

Read more

Unordered Maps

Introduction to Unordered Maps: unordered_map is an associated container data structure that stores elements formed by the combination of a key value and a mapped value. It’s similar to a dictionary but with no apparent order of key and value pairs. Properties Key-Value Map: unordered_map stores a key-value pair. Where the keys are use...

Read more

Set

Introduction to Sets: Sets are a type of associative container in which each element has to be unique because the value of the element identifies it. The values are stored in a specific sorted order i.e. either ascending or descending. Why do we need them? Set data structures are commonly used in a variety of computer science applications, in...

Read more

Unordered Sets

Introduction to Unordered Sets: std::unordered_set is a data structure that stores elements in no particular order and differs from std::set in their underlying implementation as well. Properties Set Elements : It is used to implement Set which is unordered in nature. It stores elements as keys. The value of such an element is key itse...

Read more