# DS-Explained-Simple

#### Linear Data Structures <a href="#linear-data-structures" id="linear-data-structures"></a>

Linear data structures store elements in a sequential manner. These are the most fundamental and widely used data structures.

* **Array/List** – An array or list is a linear data structure where elements are stored in a sequential manner, numbered from 0 to n-1, where n is the size of the array. The array elements can be accessed using their index.
* **Stacks** – A stack is a linear data structure that stores data in a `Last In, First Out` (LIFO) manner.
* **Queues** – A data structure that stores data in a `First In, First Out` (FIFO) manner.
* **Linked Lists** – A linear data structure that stores elements sequentially but cannot be accessed directly using an index. It consists of links to the next item, along with the data.

#### Non-Linear Data Structures <a href="#non-linear-data-structures" id="non-linear-data-structures"></a>

Non-Linear data structures are more complex data structures, that are not sequential in manner.

* **Trees** – Trees store data in a tree-like manner. They consist of a root, which contains the data and links to children nodes. The children nodes may in turn contain more children. They are the building blocks of many other Data Structures.
* **Heaps** – A heap is a tree, which is used as a priority queue. There are max-heaps, and min-heaps that contain the maximum value and the minimum value at the root node, respectively.
* **Hash Tables** – Hash Tables are data structures that contain key-value pairs. They use the concept of hashing to determine the keys in the tables. Usually used for quick access of values.
* **Graphs** – Graphs are complex data structures that implement a collection of nodes, connected together by vertices.

#### Python Collections and In-Built Data Structures <a href="#python-collections-and-in-built-data-structures" id="python-collections-and-in-built-data-structures"></a>

* **Tuples** – They are sequential data structures, that are similar to lists, but they’re immutable.
* **Dictionary** – Dictionaries are python-specific data structures that are similar to hashtables, and are used for quick access of values.
* **Sets** – A collection of unordered distinct elements, that have quick access time.
* **Collections** – Collections are a group of optimized implementations for data structures like dictionaries, maps, tuples, queues.

Now that we have an overview of data structures, let’s delve into the nuances of each of them in the upcoming articles of the series. Here are some resources to get you started with interview and programming preparation.

#### Choose a Platform <a href="#choose-a-platform" id="choose-a-platform"></a>

There are numerous platforms like [LeetCode](https://leetcode.com/), [HackerRank](https://www.hackerrank.com/), [InterviewBit](https://www.interviewbit.com/), [TopCoder](https://www.topcoder.com/), [HackerEarth](https://www.hackerearth.com/), [CodeChef](https://www.codechef.com/), [CodeForces](https://codeforces.com/), [SPOJ](https://www.spoj.com/), etc. to learn programming. Out of these, after a lot of trial and error I felt that a combination of HackerRank and LeetCode worked really well for preparing for interviews.

**HackerRank**

HackerRank is amazing because it has customized tracks for each programming language, and one each for data structures and algorithms. There are also customized filters for each DS type like Stack, Queue, etc.

**LeetCode**

LeetCode is an excellent website for company-specific preparation. If you pay for LeetCode Premium, you get company-specific questions. This is great for preparing for companies like FaceBook, Microsoft, NetFlix, Amazon, Apple, Google, etc. They also have contests and real-time mock interviews that boost your confidence and skills.

#### Implement the Data Structures from Scratch <a href="#implement-the-data-structures-from-scratch" id="implement-the-data-structures-from-scratch"></a>

By personal experience, implementing the data structures from scratch helps a lot. It helps you to understand the data structure in detail and helps in debugging, in case you run into any errors. Python offers in-build implementation for many data structures, but it is better to learn how to implement it at least once.
