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
Choose the answer that best completes the statement.
Anestetic [448]
1. A - everything starts there
2. D - always
3. C - true
4 0
3 years ago
Read 2 more answers
What is output? c = 1 sum = 0 while (c < 10): c = c + 3 sum = sum + c print (sum)
Valentin [98]

Answer:

21

Explanation:

The values of c that make it into the loop are 1, 4, 7.

The values that are added to sum are 3 higher, i.e., 4,7 and 10.

The sum of those is 21.

p.s. why did you not run the program yourself?

3 0
3 years ago
Can we opne a website form PowerPoint slide ​
Phoenix [80]

Answer:

Yes

Explanation:

Type in the link, play the presentation and click the link. Or hover over the link and press ctrl + click at the same time. (Don't know if I got the last part right)

3 0
4 years ago
Read 2 more answers
What is the biggest difference between a movie and a game?
sveta [45]

Answer:

It could be D

Explanation:

3 0
3 years ago
The rmdir command (with no options) can only remove empty directories <br> a. True <br> b. False
Anni [7]
True. It will say "directory not empty"
3 0
3 years ago
Other questions:
  • Într-o școală sunt n clase, fiecare având un număr diferit de elevi. Școală primește m pachete cu cărți, fiecare cu un număr dif
    15·1 answer
  • _____ are shown on an assembly drawing to reference parts to the parts list.
    15·1 answer
  • If the test statistic for a small sample difference of means test is t* = 2.045, we could reject the Null Hypothesis at alpha =
    9·1 answer
  • Which type of multiplexing divides transmission opportunities into slots of 125 microseconds with position inside each slot rese
    10·1 answer
  • When was kale discovered?
    9·1 answer
  • These icons cannot be removed from the Dock. Finder e-mail music player Trash
    14·1 answer
  • What is the advantage of using a translation look-aside buffer (TLB), also called associative memory, in the logical-physical ad
    15·1 answer
  • Find the smallest value of n such that LCM of n is 15 is 45​
    5·1 answer
  • Lucy wants to access the webpage. She is using her computer to access the webpage. What types of information will be in one fram
    11·1 answer
  • Write a python program to check whether the number is divisible by 7. If its divisible, print its divisible otherwise find previ
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!