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

Stack, write pseudocode to implement a queue with two stacks

write pseudocode to implement a queue with two stacks

Deletion from a red-black tree, Deletion in a RBT uses two main processes, ...

Deletion in a RBT uses two main processes, namely, Procedure 1: This is utilized to delete an element in a given Red-Black Tree. It involves the method of deletion utilized in

Definitions of graph, A graph G might be defined as a finite set V of verti...

A graph G might be defined as a finite set V of vertices & a set E of edges (pair of connected vertices). The notation utilized is as follows: Graph G = (V, E) Consider the g

Determine the complexity, 1)    The set of the algorithms whose order is O ...

1)    The set of the algorithms whose order is O (1) would run in the identical time.  True/False 2)    Determine the complexity of the following program into big O notation:

Define the term - array, Define the term - Array A fixed length, ord...

Define the term - Array A fixed length, ordered collection of values of same type stored in contiguous memory locations; collection may be ordered in several dimensions.

Explain floyds algorithm, Explain Floyd's algorithm It is convenient to...

Explain Floyd's algorithm It is convenient to record the lengths of shortest paths in an n by n matrix D known as the  distance matrix: the element d ij   in the i th   row an

Characteristics of good algorithms, What do we mean by algorithm? What are ...

What do we mean by algorithm? What are the characteristics of a good and relevant algorithm? An algorithm is "a step-by-step procedure for finishing some task'' An algorithm c

Efficient algorithms.., implementation of fast fourier transforms for non p...

implementation of fast fourier transforms for non power of 2

Method for keeping two stacks within a single linear array, Q. Define a met...

Q. Define a method for keeping two stacks within a single linear array S in such a way that neither stack overflows until entire array is used and a whole stack is never shifted to

Prims algorithm, how to implement prims algorithm dynamically

how to implement prims algorithm dynamically

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