What exactly is data structure? The simplest way to answer this is by describing it as a way of organizing and sorting data. Let me put this way. You want to find a specific book in an unorganized library, this task would take you an enormous amount of time. That’s why we need to organize our data so that operations can be performed efficiently. Detail
Mutidimentional Arrays
A basic data structure is an single array(one dimension). While in the case of mutidimentional arrays, we have rows as well as columns. In order to access an index, we need two numbers(always starting from zero).
Single Linked List
It is a collection of nodes that are connected by links. It stores the data the address to the next node. The pointer of the head node points to the next node and the pointer of the tail node points to Null. <img src=”img/posts/single-linked-list.png alt=”single list” align=”center”/> In the double linked list, the only thing that sets them apart is the pointer to the previous node. It makes it easier to traverse in either direction. So the node addtion and removal becomes super easy.
The another two is stack and queue. I bet everyone knows what they do. A stack is a LIFO data structure which means Last In First Out, the last item to come is the first one to go out. A stack can either be implemented using an array or a linked list. on the contary, A stack is a FIFO data structure which elaborates to First In First Out.