In simple words
Data structures are the ways in which you can store data inside your runtime memory for efficient usage of data.
For example: Let's say you are given a list of 10 numbers and you are asked to arrange the list of 10 numbers in ascending order. The input in the format of one number each line. Below mentioned are some of the approaches.
Approach 1: Store each number in a different integer and manually compare the values. This will be done in constant time complexity, if you are able to write the code because there are 3628800…
After graduating and working in a software firm, I always wanted to set up blogs. I found out that blogging is one of the few methods through which you can express what you have learned in life. The knowledge is not restricted technical domain but expands over to the hard-learned reality of life and the course of exploring the vast number of options one is asked to choose from. No option is right or wrong, it just directs our life to a new path.
To establish a blog from the very beginning, I started to build a website. I was…
An introduction to the Dutch Flag Algorithm.
Dutch Flag Algorithm (DFA) is one of the most basic and important algorithms for arrays. It is used to segregate an array consisting of 3 numbers in linear time complexity.
The worst time complexity for DFA is O(n) and the space complexity for the algorithm is O(1). The problem statement is as follows:
An array consisting of 0s, 1s, and 2s is provided to you. The task is to write a function that segregates all the numbers together. The order can be anything.
Let's assume that the provided array A is A =…
An array is a data structure that stores a bunch of similar typed data in a contiguous memory location. This means that the array elements can be traversed with the help of whole number indexing.
A human trying to explore the world using a Developer’s Lens