1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
xxMikexx [17]
3 years ago
13

1. Describe a linear search (explain how it works).

Computers and Technology
1 answer:
timurjin [86]3 years ago
7 0
1. A linear search searches on a straight path, hence the term “linear”. So a linear search would search from a one index to another in a straight path. For example, a linear search of an array, if given given the first and last index of the array, would search it one index after the other. First it would check index 0, then index 1, then index 2, and so forth.

2. A linear search can be useful if you are trying to find more than one instance of an value in a data structure. Since you want to search the whole array for each instance of the object or value.

3. A binary search only works with sorted data structures. It takes a data structure, finds its mid point, and checks I see if the value it is looking for is greater, less than, or equal to the midpoint value. If it is equal to the midpoint value, it’s finished and the search function is over.
If it’s greater than the midpoint, it disregards the lower half of the data structure and focuses on the upper half. If it’s less than the mid point then it disregards the upper half and focuses on the lower half.
It then repeats what it did at the beginning of the search function to again narrow down the amount of searching that needs to be done. In other words, if it disregarded the lower half of the data structure in the first part of the search, it finds the midpoint of the upper half of the data structure, checks to see if the value it’s looking for is greater than, less than, or equal to the midpoint. If it’s equal to it the searching is done, if it’s greater it disregards the lower half of the upper data structure, and repeats the process.
It will continue to do this until either the value is found or the value is not found.

4. You would use binary search if you are searching for one specific value in a sorted data structure.

5. A binary search must have a sorted data structure for it work.

6. Binary search is more efficient because the cost to run a binary search is substantially less than running a linear search.







You might be interested in
open your browser and enter the address of this ftp site in the address box: ftp.cengage. if your browser supports ftp, a logon
Licemer1 [7]

FTP access is available from other companies, but access is constrained unless the user first authenticates by supplying a user name and potentially a password.

The files are frequently intended for specific uses rather than for public release. For instance, you must send a letter house your consumer address list. Both businesses would not want the public to have access to these materials in this situation. Software is a collection of instructions, data, or computer programs that are used to run machines and carry out particular activities. It is the antithesis of hardware, which refers to a computer's external components. A device's running programs, scripts, and applications are collectively referred to as "software" in this context. Software refers to the processes and programs that enable a computer or other electrical device to function.

Learn more about software here-

brainly.com/question/985406

#SPJ4

7 0
1 year ago
The transitions between slides in a presentation are one type of powerpoint ____.
slava [35]
The transitions between slides in a presentation are one of type of power point 
Animation.
Animation is a set of effects which can be applied to objects in power point  so that they will animate in the slideshow power point.motion paths allow objects to move around the slide show.
4 0
3 years ago
What is the best definition of a network?
Cerrena [4.2K]

Answer:

C is the answer to this question.

3 0
2 years ago
Read 2 more answers
A _______________ is a field that contains data unique to a record.
Andru [333]

A primary key is a field that contains data unique to a record

8 0
3 years ago
Given the value x=false ,y=5 and z=1 what will be the value of F=(4%2)+2*Y +6/2 +(z&&x)?
Bezzdna [24]
<h2>Answer:</h2>

F = 13

<h2>Explanation:</h2>

Given:

x = false

y = 5

z = 1

F = (4%2)+2*Y +6/2 +(z&&x)

We solve this arithmetic using the order of precedence:

<em>i. Solve the brackets first</em>

=> (4 % 2)

This means 4 modulus 2. This is the result of the remainder when 4 is divided by 2. Since there is no remainder when 4 is divided by 2, then

4 % 2 = 0

=> (z && x)

This means (1 && false). This is the result of using the AND operator. Remember that && means AND operator. This will return false (or 0) if one or both operands are false. It will return true (or 1) if both operands are true.

In this case since the right operand is a false, the result will be 0. i.e

(z && x) = (1 && false) = 0

<em>ii. Solve either the multiplication or division next whichever one comes first.</em>

=> 2 * y

This means the product of 2 and y ( = 5). This will give;

2 * y = 2 * 5 = 10

=> 6 / 2

This means the quotient of 6 and 2. This will give;

6 / 2 = 3

<em>iii. Now solve the addition by first substituting the values calculated earlier back into F.</em>

F = (4%2)+2*Y +6/2 +(z&&x)

F = 0 + 10 + 3 + 0

F = 13

Therefore, the value of F is 13

5 0
2 years ago
Other questions:
  • On the Picture Tools Layout tab, you can preview results of the numerous styles, borders, effects, and layouts by _______ comman
    7·2 answers
  • The ____ file permission category in unix/linux systems typically entails all permissions and is designated by the letter u.
    7·1 answer
  • What are some examples of lighter-than-air vehicles?
    10·1 answer
  • When a compiler finds errors, it usually indicates what they are so you can correct the code and compile the program again?
    11·1 answer
  • 11.The shortcut keys used to center a paragraph are&lt;br /&gt;a. CTRL+T&lt;br /&gt;b. CTRL+M&lt;br /&gt;c. CTRL+SHIFT+T d. CTRL
    7·1 answer
  • A franchise restaurant is attempting to understand if customers think their service is good day-to-day by summarizing a series o
    10·1 answer
  • What keyboard functions lets you delete words
    15·2 answers
  • Anyone wanna join zoo m???????​
    10·2 answers
  • What is the difference between MySQL and MariaDB?
    9·1 answer
  • Briefly describe the working of computer processing system?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!