A linear array is a not a non-linear array
depends on the number of elements and their datatype present in the array.
Linear data is the data that can be traversed sequentially like list and array.
it is called linear ds because the memory allocation of the data in array is contiguous unlike list and trees.the memory is alocatted initially and the elements are fed into it in a linear order till the limit of array is encountered.insertion in between is not possible.
in liner search the array is not mandatory to be a sorted array,but in binary search the array must be a sorted array.
Linear : Traversal is linear .. ex: array,linked lists,stacks,queues NoN-linear: Traversal is not linear.. ex:trees,graphs imagine the situation of searching of particular element..in above scenarious..then u will understand easily.. Linear : Traversal is linear .. ex: array,linked lists,stacks,queues NoN-linear: Traversal is not linear.. ex:trees,graphs imagine the situation of searching of particular element..in above scenarious..then u will understand easily.. Linear : Traversal is linear .. ex: array,linked lists,stacks,queues NoN-linear: Traversal is not linear.. ex:trees,graphs imagine the situation of searching of particular element..in above scenarious..then u will understand easily..
depends on the number of elements and their datatype present in the array.
Linear data is the data that can be traversed sequentially like list and array.
it is called linear ds because the memory allocation of the data in array is contiguous unlike list and trees.the memory is alocatted initially and the elements are fed into it in a linear order till the limit of array is encountered.insertion in between is not possible.
in liner search the array is not mandatory to be a sorted array,but in binary search the array must be a sorted array.
Running time of a linear search is O(n)
Both are linear data structures.
Sequential search of an object with in an array of objects is called as linear search.
Linear : Traversal is linear .. ex: array,linked lists,stacks,queues NoN-linear: Traversal is not linear.. ex:trees,graphs imagine the situation of searching of particular element..in above scenarious..then u will understand easily.. Linear : Traversal is linear .. ex: array,linked lists,stacks,queues NoN-linear: Traversal is not linear.. ex:trees,graphs imagine the situation of searching of particular element..in above scenarious..then u will understand easily.. Linear : Traversal is linear .. ex: array,linked lists,stacks,queues NoN-linear: Traversal is not linear.. ex:trees,graphs imagine the situation of searching of particular element..in above scenarious..then u will understand easily..
To increase knowledge on a topic
Linear search
linear search array for key and return index of firstoccurrence.intfindInteger(int array[], int asize, int key) {int* p = array;while (asize-- && *p != key)++p;return p - array;}
A linear data structure is one in which, while traversing sequentially, we can reach only one element directly from another. Eg- Linked List, Array.2D array, though seems to be non-linear, is actually linear data structure. This is because memory is single dimensional and when it is stored in the memory it is stored as a single dimension array in either row-major or column-major format. Similarly all multi-dimensional arrays are also linear, for the same reason.