List all the steps used to search for 9 in the sequence 1,3,4,5,6,8,9,11 using linear search

Question
Discrete math
asked 2021-02-02
List all the steps used to search for 9 in the sequence \(\displaystyle{1},{3},{4},{5},{6},{8},{9},{11}\) using linear search

Answers (1)

2021-02-03
It's not at all clear from your question how much detail is expected or whether the steps are to be implemented by a computer or a human. For example, do we need to include steps like "copy value X into memory register Y" or "go grab a sheet of paper to write on"? It's also not clear whether you just want a True or False returned or the position in the list.
But here's the basic procedure that you should be able to complexify as you require.
Check if 1 == 9. It does not.
Check if 3 == 9. It does not.
Check if 4 == 9. It does not.
Check if 5 == 9. It does not.
Check if 6 == 9. It does not.
Check if 8 == 9. It does not.
Check if 9 == 9. It does.
Return True.
The basic idea of linear search is to start at the beginning of the list and just keep going through it until you find the value you're looking for or run out of numbers in your list, whichever happens first.
0

Relevant Questions

asked 2021-03-11
The following problem is solved by using factors and multiples and features the strategies of guessing and checking and making an organized list.
Problem
A factory uses machines to sort cards into piles. On one occasion a machine operator obtained the following curious result.
When a box of cards was sorted into 7 equal groups, there were 6 cards left over, when the box of cards was sorted into 5 equal groups, there were 4 left over, and when it was sorted into 3 equal groups, there were 2 left.
If the machine cannot sort more than 200 cards at a time, how many cards were in the box?
asked 2020-12-28
An experiment on the probability is carried out, in which the sample space of the experiment is
\(S = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}.\)
Let event \(E={2, 3, 4, 5, 6, 7}, event\)
\(F={5, 6, 7, 8, 9}, event G={9, 10, 11, 12}, and event H={2, 3, 4}\).
Assume that each outcome is equally likely. List the outcome s in For G.
Now find P( For G) by counting the number of outcomes in For G.
Determine P (For G ) using the General Addition Rule.
asked 2021-01-05
Let \(\displaystyle{A}_{{{2}}}{A}_{{{2}}}\) be the set of all multiples of 2 except for 2.2. Let \(\displaystyle{A}_{{{3}}}{A}_{{{3}}}\) be the set of all multiples of 3 except for 3. And so on, so that \(\displaystyle{A}_{{{n}}}{A}_{{{n}}}\) is the set of all multiples of nn except for n,n, for any \(\displaystyle{n}\geq{2}.{n}\geq{2}\). Describe (in words) the set \(\displaystyle{A}_{{{2}}}\cup{A}_{{{3}}}\cup{A}_{{{4}}}\cup\ldots\)
asked 2020-12-25
Im confused on this question for Discrete Mathematics.
Let \(\displaystyle{A}_{{{2}}}\) be the set of all multiples of 2 except for 2. Let \(\displaystyle{A}_{{{3}}}\) be the set of all multiples of 3 except for 3. And so on, so that \(\displaystyle{A}_{{{n}}}\) is the set of all multiples of n except for n, for any \(\displaystyle{n}\geq{2}\). Describe (in words) the set \(\displaystyle{A}_{{{2}}}\cup{A}_{{{3}}}\cup{A}_{{{4}}}\cup\ldots\).
asked 2020-11-10
For the following, write your list in increasing order, separated by commas.
a, List the first 10 multiples of 8.
b. LIst the first 10 multiples on 12.
c. Of the lists you produced in parts a. and b., list the multiples that 8 and 12 have in common.
d. From part c., what is the smallest multiple that 8 and 12 have in common.
asked 2020-11-14
List the first five common multiples in ascending order for each pair of numbers.
a.6,16
asked 2020-12-02
Gastroenterology
We present data relating protein concentration to pancreatic function as measured by trypsin secretion among patients with cystic fibrosis.
If we do not want to assume normality for these distributions, then what statistical procedure can be used to compare the three groups?
Perform the test mentioned in Problem 12.42 and report a p-value. How do your results compare with a parametric analysis of the data?
Relationship between protein concentration \((mg/mL)\) of duodenal secretions to pancreatic function as measured by trypsin secretion:
\(\left[U/\left(k\ \frac{g}{h}r\right)\right]\)
Tapsin secreton [UGA]
\(\leq\ 50\)
\(\begin{array}{|c|c|}\hline \text{Subject number} & \text{Protetion concentration} \\ \hline 1 & 1.7 \\ \hline 2 & 2.0 \\ \hline 3 & 2.0 \\ \hline 4 & 2.2 \\ \hline 5 & 4.0 \\ \hline 6 & 4.0 \\ \hline 7 & 5.0 \\ \hline 8 & 6.7 \\ \hline 9 & 7.8 \\ \hline \end{array}\)
\(51\ -\ 1000\)
\(\begin{array}{|c|c|}\hline \text{Subject number} & \text{Protetion concentration} \\ \hline 1 & 1.4 \\ \hline 2 & 2.4 \\ \hline 3 & 2.4 \\ \hline 4 & 3.3 \\ \hline 5 & 4.4 \\ \hline 6 & 4.7 \\ \hline 7 & 6.7 \\ \hline 8 & 7.9 \\ \hline 9 & 9.5 \\ \hline 10 & 11.7 \\ \hline \end{array}\)
\(>\ 1000\)
\(\begin{array}{|c|c|}\hline \text{Subject number} & \text{Protetion concentration} \\ \hline 1 & 2.9 \\ \hline 2 & 3.8 \\ \hline 3 & 4.4 \\ \hline 4 & 4.7 \\ \hline 5 & 5.5 \\ \hline 6 & 5.6 \\ \hline 7 & 7.4 \\ \hline 8 & 9.4 \\ \hline 9 & 10.3 \\ \hline \end{array}\)
asked 2020-11-24
Draw the Hasse diagram representing the partial ordering {(a, b) | a divides b} on {1, 2, 3, 4, 6, 8, 12}.
asked 2021-02-09
A two-sample inference deals with dependent and independent inferences. In a two-sample hypothesis testing problem, underlying parameters of two different populations are compared. In a longitudinal (or follow-up) study, the same group of people is followed over time. Two samples are said to be paired when each data point in the first sample is matched and related to a unique data point in the second sample.
This problem demonstrates inference from two dependent (follow-up) samples using the data from the hypothetical study of new cases of tuberculosis (TB) before and after the vaccination was done in several geographical areas in a country in sub-Saharan Africa. Conclusion about the null hypothesis is to note the difference between samples.
The problem that demonstrates inference from two dependent samples uses hypothetical data from the TB vaccinations and the number of new cases before and after vaccination. PSK\begin{array}{|c|c|} \hline Geographical\ regions & Before\ vaccination & After\ vaccination\\ \hline 1 & 85 & 11\\ \hline 2 & 77 & 5\\ \hline 3 & 110 & 14\\ \hline 4 & 65 & 12\\ \hline 5 & 81 & 10\\\hline 6 & 70 & 7\\ \hline 7 & 74 & 8\\ \hline 8 & 84 & 11\\ \hline 9 & 90 & 9\\ \hline 10 & 95 & 8\\ \hline \end{array}ZSK
Using the Minitab statistical analysis program to enter the data and perform the analysis, complete the following: Construct a one-sided \(\displaystyle{95}\%\) confidence interval for the true difference in population means. Test the null hypothesis that the population means are identical at the 0.05 level of significance.
asked 2020-10-23
The table below shows the number of people for three different race groups who were shot by police that were either armed or unarmed. These values are very close to the exact numbers. They have been changed slightly for each student to get a unique problem.
Suspect was Armed:
Black - 543
White - 1176
Hispanic - 378
Total - 2097
Suspect was unarmed:
Black - 60
White - 67
Hispanic - 38
Total - 165
Total:
Black - 603
White - 1243
Hispanic - 416
Total - 2262
Give your answer as a decimal to at least three decimal places.
a) What percent are Black?
b) What percent are Unarmed?
c) In order for two variables to be Independent of each other, the P \((A and B) = P(A) \cdot P(B) P(A and B) = P(A) \cdot P(B).\)
This just means that the percentage of times that both things happen equals the individual percentages multiplied together (Only if they are Independent of each other).
Therefore, if a person's race is independent of whether they were killed being unarmed then the percentage of black people that are killed while being unarmed should equal the percentage of blacks times the percentage of Unarmed. Let's check this. Multiply your answer to part a (percentage of blacks) by your answer to part b (percentage of unarmed).
Remember, the previous answer is only correct if the variables are Independent.
d) Now let's get the real percent that are Black and Unarmed by using the table?
If answer c is "significantly different" than answer d, then that means that there could be a different percentage of unarmed people being shot based on race. We will check this out later in the course.
Let's compare the percentage of unarmed shot for each race.
e) What percent are White and Unarmed?
f) What percent are Hispanic and Unarmed?
If you compare answers d, e and f it shows the highest percentage of unarmed people being shot is most likely white.
Why is that?
This is because there are more white people in the United States than any other race and therefore there are likely to be more white people in the table. Since there are more white people in the table, there most likely would be more white and unarmed people shot by police than any other race. This pulls the percentage of white and unarmed up. In addition, there most likely would be more white and armed shot by police. All the percentages for white people would be higher, because there are more white people. For example, the table contains very few Hispanic people, and the percentage of people in the table that were Hispanic and unarmed is the lowest percentage.
Think of it this way. If you went to a college that was 90% female and 10% male, then females would most likely have the highest percentage of A grades. They would also most likely have the highest percentage of B, C, D and F grades
The correct way to compare is "conditional probability". Conditional probability is getting the probability of something happening, given we are dealing with just the people in a particular group.
g) What percent of blacks shot and killed by police were unarmed?
h) What percent of whites shot and killed by police were unarmed?
i) What percent of Hispanics shot and killed by police were unarmed?
You can see by the answers to part g and h, that the percentage of blacks that were unarmed and killed by police is approximately twice that of whites that were unarmed and killed by police.
j) Why do you believe this is happening?
Do a search on the internet for reasons why blacks are more likely to be killed by police. Read a few articles on the topic. Write your response using the articles as references. Give the websites used in your response. Your answer should be several sentences long with at least one website listed. This part of this problem will be graded after the due date.
...