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

Multiple Queues in a single dimension array, Implement multiple queues in a...

Implement multiple queues in a single dimensional array. Write algorithms for various queue operations for them.

COBOL, write a COBOL program to find the biggest of two numbers

write a COBOL program to find the biggest of two numbers

Write a program for linear search, In the book the following methods are pr...

In the book the following methods are presented: static void selectionSort(Comparable[] list) static void insertionSort(Comparable[] list) static boolean linearSearch(Comparable

Explain about the abstract data type, Explain about the Abstract data type ...

Explain about the Abstract data type Abstract data type (ADT) A set of values (the carrier set) and operations on those values

How does an array differ from an ordinary variable, Normal 0 fa...

Normal 0 false false false EN-IN X-NONE X-NONE MicrosoftInternetExplorer4

Data manipulation, perform the following length operation LENGTH("welcome t...

perform the following length operation LENGTH("welcome to ICA")=

Algorithm and flow chart, algorithm and flow chart to find weather the give...

algorithm and flow chart to find weather the given numbers are positive or negative or neutral

Depth first search and breadth first search, Q. Illustrate the result of ru...

Q. Illustrate the result of running BFS and DFS on the directed graph given below using vertex 3 as source.  Show the status of the data structure used at each and every stage.

Variable length codes, Variable length codes (Niveau I) Code the following ...

Variable length codes (Niveau I) Code the following sequence of integers (2, 4, 2, 8, 3, 1, 4, 5, 13, 2) with • unary codes • ? codes • d codes • Rice codes (for a suitable l) and

Algorithm, implement multiple stack in one dimensional array

implement multiple stack in one dimensional array

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