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]
4 years ago
13

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

Computers and Technology
1 answer:
timurjin [86]4 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
Compose a loop program to examine the eight bytes in the words y and z. If a byte is the code for a decimal number, output it to
Over [174]

Answer:

See explaination

Explanation:

A loop program is a type of program that supports iteration.

It is a conditional statement ptogram that produces its result after a series of iteration or repetition from one loop to the other.

Please go to attachment for the loop program that examines the eight bytes in the words y and z. If a byte is the code for a decimal number, output it to the console. Otherwise, simply ignore it and examine the next byte.

5 0
4 years ago
1. algorithm<br> Definition
pentagon [3]

Answer:

Definition

Explanation:

A process or set of rules to be followed of calculations or other problem-solving operations, especially by a computer.

7 0
3 years ago
2) State True or False. 1. Abacus is an electronic device. 2. ROM is read and writes memory of computer. 3. Header and footer ap
mr_godi [17]

Answer:

1 false

2 false

3 false

4  true

5 false

Explanation:

7 0
3 years ago
Read 2 more answers
A​ _______ helps us understand the nature of the distribution of a data set.
Sphinxa [80]

Frequency distribution
3 0
3 years ago
How many constructors are there in the following class declaration?class CashRegister { public: CashRegister(); CashRegister(int
Mariana [72]

Answer:

a. 0

Explanation:

There are zero constructors in the given class declaration. There is a cash register which is in count for public. There is a private cash register which shows the item count as zero.

7 0
3 years ago
Other questions:
  • Easy STEAM question :)
    15·2 answers
  • The point on the middle of an edge in SketchUp is called a...
    5·2 answers
  • PLEASE HELP! Which aspect helps you to change the luminescence of your image?
    10·2 answers
  • PLEASE HELP
    6·1 answer
  • Sabiendo que el engranaje motriz tiene 14 dientes y gira a 4000 RPM, y el conducido tiene 56 dientes, responde:
    11·1 answer
  • To reload a picture taken with a digital camera means to copy the digital picture from the camera to your computer.
    5·2 answers
  • What is the difference between word processing software and email?
    12·2 answers
  • When considering the best technology for its particular use, what should a business consider
    15·2 answers
  • Greg wants to check the amount of requests his website receives. What test can he use?
    6·1 answer
  • Which display technology was developed by apple, produces vibrant colors, and supports viewing from all angles?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!