Algorithm for linear search, Data Structure & Algorithms

Assignment Help:

Here,  m represents the unordered array of elements n  represents number of elements in the array and el  represents the value to be searched in the list

Sep 1: [Initialize]

           k=0

           flag=1

Step 2: Repeat step 3 for k=0,1,2.....n-1

Step 3: if (m[k]=el )

               then

              flag=0

               print "Search is successful" and element is found at location (k+1)

               stop

               endif

Step 4: if (flag=1) then

             printf "not successful"

               endif

Step 5: stop


Related Discussions:- Algorithm for linear search

Insert an element after an element pointed by some pointer, Consider a link...

Consider a linked list of n elements. What is the time taken to insert an element after an element pointed by some pointer? O (1)

Algorithm to merge two sorted arrays with third array, Q. Write down an alg...

Q. Write down an algorithm to merge the two sorted arrays into the third array. Do  not perform the sort function in the third array.                           Ans: void m

Queue, algorithm for insertion in a queue using pointers

algorithm for insertion in a queue using pointers

Red black tree, red black tree construction for 4,5,6,7,8,9

red black tree construction for 4,5,6,7,8,9

Flow chart, that will determine the volume of the sphere or the volume of c...

that will determine the volume of the sphere or the volume of cone or volume of pyramid depending on the choice of the user

Hash clash, Q. What do you understand by the term by hash clash? Explain in...

Q. What do you understand by the term by hash clash? Explain in detail any one method to resolve the hash collisions.

Usage of linked lists for polynomial manipulation, Q. Establish the usage o...

Q. Establish the usage of linked lists for polynomial manipulation.                                       Ans. Usag e of Linked List for Polynomial Manipulation. Link

Operating system, discuss the operating system under the following: MONOLIT...

discuss the operating system under the following: MONOLITHIC SYSTEM,LAYER SYSTEM AND VIRTUAL MACHINES

Pipeling, Asktypes of pipelining question #Minimum 100 words accepted#

Asktypes of pipelining question #Minimum 100 words accepted#

Binary tree, A binary tree is a tree data structures in which each node hav...

A binary tree is a tree data structures in which each node have at most two child nodes, generally distinguished as "right" and "left". Nodes with children are called parent nodes,

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd