

 Thread Tools  Search this Thread 
#1
 
 
What is linear search in data structure? Hey friends, I want to know the basic topics of data structure you can say the starting topic of data structure. I am thinking to learn data structure but before that I want to know the basics of data structure. If I could know some of the basic topics of data structure then I could have some basic knowledge about it. So, if anybody having any data regarding this topic then please let me know. 
#2
 
 
Re: What is linear search in data structure? This is simplest method of searching. In this method, the element to be found is sequentially searched in the list. This method can be applied to a sorted list or unsorted list. Searching in case of Sorted list starts from 0th elements and continues until the element is found or an element whose value is greater than the value being searched is reached. You might find this searching method as the simplest as it is the first topic of data structure and it is quite easy to understand. 
#3
 
 
Re: What is linear search in data structure? Code: Declare array AA store elements in to array AA take nmber to be searched from user and store in num repeat for i=o to l(ength of AA)1 check if AA[i]==num come out of loop repeat step 6 to 7 check if i== 1o print: num not found else print : num found at location i end of loop 
#4
 
 
Re: What is linear search in data structure? Code: #include <stdio.h> #include <conio.h> void main( ) { int arr[10] = { 11, 2, 9, 13, 57, 25, 17, 1, 90, 3 } ; int i, num ; clrscr( ) ; printf ( "Enter number to search: " ) ; scanf ( "%d", &num ) ; for ( i = 0 ; i <= 9 ; i++ ) { if ( arr[i] == num ) break ; } if ( i == 10 ) printf ( "Number is not present in the array." ) ; else printf ( "The number is at position %d in the array.", i ) ; getch( ) ; } 

Tags: array, array list, data structure, linear search, sorting 
Thread Tools  Search this Thread 

Similar Threads for: "What is linear search in data structure?"  
Thread  Thread Starter  Forum  Replies  Last Post 
What is the use of insertion sort in data structure?  Venugopala  Software Development  3  04012011 02:41 AM 
What do you mean by stacks in Data structure  Shiva$m  Software Development  3  04012011 12:20 AM 
What is the binary search in data structure  Alibamu  Software Development  3  03012011 08:42 AM 
Variables and data structure in Perl  Monty1  Tips & Tweaks  2  28092010 07:53 PM 
Choice of data structure  Hashim  Software Development  5  02112009 07:27 PM 