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
Sladkaya [172]
4 years ago
11

Consider the problem of linear search. the input is a sequence of n numbers a = ha1, a2, . . . , ani and a target value v. the o

utput is an index i such that v = a[i] or the special value nil if v does not appear in
a.
Mathematics
1 answer:
pochemuha4 years ago
6 0
Pseudocode of a possible algorithm for linear search, generally applicable to unsorted sequences/lists.
We assume that the list index starts with 1, i.e. first item of the list is a[1]=a1, and the ith item is a[i]=ai.


value:v; // define and initialize comparison variable
v:nil;     // prescribed special value
i:0         // define and initialize counter
while (i<n and v==nil) do{    // terminates while if value found, or n cycles reached
  i:i+1;
  if a[i]==value then v=i;   // index of matching value
}
// if value not found, v=nil, else v=i, the index of the list/array where found
You might be interested in
Is 1/2 √9 *√4 rational or irrational​
zloy xaker [14]

Answer:

1/2 and 9 is rational but 4 is not

Step-by-step explanation:

A rational number is a number that can be written as a ratio. That means it can be written as a fraction, in which both the numerator (the number on top) and the denominator (the number on the bottom) are whole numbers.

Hope this helps <3 Wanna get ranked faster? Comment "rankup"

6 0
3 years ago
A mass attached to a spring is pulled toward the floor so that its height above the floor is 10 mm (millimeters). The mass is th
e-lub [12.9K]

Answer:

a) The mass is released at t = 0 when h is minimum. Half a cycle later h reaches its maximum and another half a cycle it reaches its minimum again. Hence over one cycle, h varies with t as follows:

b) According to the graph obtained in part a), h(t) could be modeled by a cosine function shifted (translated) vertically up and horizontally to the right. Hence

Step-by-step explanation:

5 0
3 years ago
Mixed in a drawer are 44 blue​ socks, 88 white​ socks, and 44 gray socks. You pull out two​ socks, one at a​ time, without looki
MrRissso [65]

Answer:

The probability of getting 2 socks of the same color is 1/3.

Step-by-step explanation:

In the drawer,

Number of blue socks = 4

Number of white socks = 8

Number of gray socks = 4

Total number of socks  = 4 + 8 + 4 = 16

Total ways to select 2 socks form 16 socks is

^{16}C_2=\dfrac{16!}{2!(16-2)!}=120

Total ways to select 2 socks of the same color is

T = Possible ways of (2 blue + 2 white +2 gray) socks

  = ^{4}C_2+^{8}C_2+^{4}C_2

  = 6+28+6

  = 40

The probability of getting 2 socks of the same color is

Probability=\dfrac{\text{Total ways to select 2 socks of the same color}}{\text{Total ways to select 2 socks form 16 socks}}

Probability=\dfrac{40}{120}

Probability=\dfrac{1}{3}

Therefore, the probability of getting 2 socks of the same color is 1/3.

3 0
3 years ago
(5x4 + 5x3 + 4x - 9) + (2x4 + 7x2 + 2x + 14)
ladessa [460]

Answer:

7x⁴ + 5x³ + 7x² + 6x + 5

Step-by-step explanation:

The given expression is

(5x4 + 5x3 + 4x - 9) + (2x4 + 7x2 + 2x + 14)

The first step is to open the brackets by multiplying each term inside each bracket by the term outside each bracket. Since the term outside each bracket is 1, the expression becomes

5x⁴ + 5x³ + 4x - 9 + 2x⁴ + 7x² + 2x + 14

We would collect like terms by combining each term with the same exponent or raised to the same power. The term would be arranged in decreasing order of the exponents. It becomes

5x⁴ + 2x⁴ + 5x³ + 7x² + 4x + 2x - 9 + 14

7x⁴ + 5x³ + 7x² + 6x + 5

7 0
4 years ago
Tom opens a bank account and makes an initial deposit of 500$. Then banker tells Tom that he is going to receive an annual rate
Arturiano [62]

~~~~~~ \textit{Compound Interest Earned Amount} \\\\ A=P\left(1+\frac{r}{n}\right)^{nt} \quad \begin{cases} A=\textit{accumulated amount}\\ P=\textit{original amount deposited}\dotfill &\$500\\ r=rate\to 6\%\to \frac{6}{100}\dotfill &0.06\\ n= \begin{array}{llll} \textit{times it compounds per year}\\ \textit{annually, thus once} \end{array}\dotfill &1\\ t=years\dotfill &15 \end{cases} \\\\\\ A=500\left(1+\frac{0.06}{1}\right)^{1\cdot 15}\implies A=500(1.06)^{15}\implies A\approx 1198.28

5 0
2 years ago
Other questions:
  • Patrick is buying a new pair of shoes. The expression shown below represents the sales tax on the price of the shoes,s. 0.06s By
    9·2 answers
  • What is the approximate area of the circle? Use A. 17.6 square inches B. 24.6 square inches C. 35.2 square inches D. 98.5 square
    6·1 answer
  • A quarter circle is attached to the side of a square as shown.
    10·2 answers
  • A scale on a map shows that 2 inches equals 25 miles. How many miles is represented by 1/4 inch on the map?
    7·1 answer
  • kelli and her faimly went to the beach for a vacation. they drove 293 miles 7 hours to get theredid they drive each hour
    9·2 answers
  • PLEASE HELP ME ANSWER THIS!!! PLEASE
    12·2 answers
  • WHOEVER ANSWERS FIRST GETS BRAINLIEST AND I NEED AN EXPLANATION PLZ
    9·2 answers
  • [FOLLOW-UP FOR LAST QUESTION] Whenever inappropriate, unacademic, or irrelevant (or plain idiotic) questions are asked on Brainl
    11·2 answers
  • HURRRY I HAVE 5 minutes! WILL GIVE BRAINLIEST
    10·1 answer
  • Please help me please
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!