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
Which of the following best describes the difference between the domain and path of a URL?
Lana71 [14]

Answer:

the first choice

Explanation:

8 0
3 years ago
What is the purpose of a register in a CPU? Describe three types of registers.
Ganezh [65]

Answer:

I hope this answer is correct

Explanation:

Internal registers include the instruction register (IR), memory buffer register (MBR), memory data register (MDR), and memory address register (MAR). The instruction register fetches instructions from the program counter (PC) and holds each instruction as it is executed by the processor.

5 0
3 years ago
Why does the Asian region have the highest number of Internet users?
erica [24]
Although Asia has the most poverty, it also has the most population. Hope this helps!
4 0
3 years ago
Read 2 more answers
Can somebody help me with this plzzz, I watched the video but I don’t got it :’(
krek1111 [17]

Answer:

n,

Explanation:

4 0
3 years ago
Read 2 more answers
Find a quote that you like. Store the quote in a variable, with an appropriate introduction such as "Ken Thompson once said, 'On
pishuonlain [190]

Answer:

The program to this question as follows:

Program:

quote="You can always edit a bad page. You can’t edit a blank page."

name="Jodi Picoult"

print("Quote:\n",quote)

print ('\t\t\t\t\t\t\t',"Author name-", name)

Output:

Quote:

You can always edit a bad page. You can’t edit a blank page.

       Author name- Jodi Picoult

Explanation:

In the above python code, two variable "quote and name" is defined, in which variable both variable holds some string value.

  • In the next line, the print function is defined, that first print "Quote" as a message, and for line breaking "\n" is used, then print quote variable value.
  • In the last step, first, we use "\t" for line spacing then message "Author name-", and then name variable value.
7 0
3 years ago
Other questions:
  • Universal Containers has a requirement to integrate Salesforce with an external system to control record access.
    12·1 answer
  • The following algorithm computes the average height for a list of basketball player heights. Initialize a variable sum to 0. For
    11·2 answers
  • I analyze data, as a consultant, for companies making important business decisions. In order to get my point across, which of th
    11·1 answer
  • Write down a program in SNOBOL thatcalculates the factorial of 7.
    10·1 answer
  • Can i edit my name on this app?
    7·1 answer
  • When should you save your document?
    15·2 answers
  • What is the next line? >>> tupleB = (5, 7, 5, 10, 2, 7) >>> tupleB.count(7) 1 0 5 2
    9·1 answer
  • 8.11 LAB: Count characters - functions Write a program whose input is a character and a string, and whose output indicates the n
    6·1 answer
  • Write a function that accepts a positive random number as a parameter and returns the sum of the random number's digits. Write a
    10·1 answer
  • What do conditions do for programs?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!