Posts

Showing posts from July, 2020

Data Structures - Linear Data Structures

Image
Data structure is an organizational way of storing data in the computer and it reduce the time and cost of data access. And also it can reduce the storage space of data. In this post, I am going to consider about Linear Data Structures (LDS). Under LDS, there are few popular data structures that are commonly used. 1. Array 2. Linked List 3. Stack 4. Queue Array Array is a data structure used to store data that are in same data type at contiguous spaces. The size of an array must be assigned before storing data. Each and every storage space can accessed separately. The index of array list starts from 0 and end with size -1.             Ex: int[] arr = new int[5];        or     int[] arr;                    or              int[] arr = {1,2,3,4,5};                     arr[0] = 1;                                        arr = new int[] {1,2,3,4,5};     When considering the size of array is equal to n.  Accessing Time   O(1)  because data are stored at near by spaces   Search Time        O(n