Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Linear search is not the most efficient way to search an item within a collection of items. Though, it is extremely simple to implement. Furthermore, if the array elements are arranged into random order, it is the merely a reasonable way to search. Additionally, efficiency becomes significant only in large arrays; if the array is small, there aren't various elements to search and the amount of time it takes is not even noticed by the user. Therefore, for several conditions, linear search is a perfectly valid approach.

Before learning Linear Search, let us described some terms associated to search.

A file is a set of records and a record is in turn a collection of fields. A field, that is utilized to differentiate among several records, is known as a 'key'.

For instance, the telephone directory that we discussed in earlier section can be assumed as a file, where each record contains two fields: name of the person & phone number of the person.

Now, it depends on the application whose field will be the 'key'. It can be the name of person (usual case) and it can also be phone number. We will situate any particular record by matching the input argument 'a' with the key value.

The simplest of all the searching techniques is Linear or Sequential Search. As the name suggests, all the records in a file are searched sequentially, one by one, for the matching of key value, till a match occurs.

The Linear Search is applicable to a table which it should be organised in an array. Let us assume that a file contains 'n' records and a record has 'a' fields but only one key. The values of key are organised in an array say 'm'. As the file has 'n' records, the size of array will be 'n' and value at position R(i) will be the key of record at position i. Also, let us assume that 'el' is the value for which search has to be made or it is the search argument.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M9619455

Have any Question?


Related Questions in Computer Engineering

Structureswrite the program in c onlytask create a seating

Structures Write the Program in C++ only. Task: Create a seating reservation program for Podunk Airlines. The air fleet consists of a single plane with a seating capacity of 12. The plane makes one flight daily. Your pro ...

On a certain banking machine customers arrive at an average

On a certain banking machine customers arrive at an average of 15 per hour. a) What is the probability that 12 customers will use the machine in the next hour? b) What is the probability that there will be fewer than 3 c ...

Synchronize threads write a program that launches 1000

Synchronize threads. Write a program that launches 1,000 threads. Each thread adds 1 to a variable sum that initially is 0. Define an Integer wrapper object to hold sum. Create two versions of the program with and withou ...

Test 1 - open loop level step response test1objective to

Test 1 - Open Loop Level Step Response Test 1)Objective: To get familiar with the process vessel and to measure the time constant. Procedure 1 1) Start the CE2000 software and load ?le ‘exp4-1.ict'. You will see the soft ...

With regards to data mining business analytics why is it

With regards to data mining/ business analytics, Why is it not ideal to evaluate a classifier's performance on the training data set?

Scenario 1 19500 ascii characters are transmitted over a 3

Scenario 1: 19,500 ASCII characters are transmitted over a 3 Mbps circuit. The protocol uses 8-bits to encode each ASCII character, and adds an additional parity bit to help detect errors. Calculate the transmission effi ...

Your solution will entail writing a function called

Your solution will entail writing a function called TimeDifference and a test main that demonstrates that you can compute the time difference in minutes between the two times. TimeDifference is a function that receives a ...

Suppose you are a manager in the it department for the

Suppose you are a manager in the IT department for the government of a corrupt dictator, who has a collection of computers that need to be connected together to create a communication network for his spies. You are given ...

Java program that prompts the user to enter the base and

Java program that prompts the user to enter the base and slant height for a regular pyramid shape, then calculates and outputs its volume and surface area. A and B are requirements A It is required to use JOptionPane's I ...

Several basic principles or reasons make psychological

Several basic "principles" or reasons make psychological social engineering effective. These include authority, intimidation, consensus/social proof, scar- city, urgency, familiarity/liking, and trust. Table 2-6 in your ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As