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
SVEN [57.7K]
3 years ago
7

Determine the number of character comparisons made by the brute-force algorithm in searching for the pattern GANDHI in the text

Computers and Technology
1 answer:
leonid [27]3 years ago
3 0

Answer:

Total number of character comparison = 43

Explanation:

Using the Brute force algorithm

The string of n characters is known as text, and the string of m characters is known as the pattern.

From the given information:

The text (n)=THERE_IS_MORE_TO_LIFE_THAN_INCREASING_ITS_SPEED

The pattern (m) = GANDHI

The total no of characters that we have in the text = 47

The total number of characters in pattern = 6

For a brute force algorithm;

Since; the first character of the pattern does not exist in the text, then the number of trials made can be attempted can be expressed as = n – m + 1

= 47 – 6 + 1

= 47 – 5

= 42

Thus; the algorithm will attempt the trial 42 times.

Now, for loop in the algorithm to run 42 times, the G in the pattern will have to align against the for T in the text, and in the last case, it will be aligned against the last space.

On each attempted trial, the algorithm will make one unsuccessful comparison.

However, at the trial at which the G in the pattern Is aligned with the G in the text, there will be two successful comparisons.

Hence, we can calculate the total number of character comparison as follows:

Total number of character comparison = \mathbf{\bigg ( ( 42 -  (no. \ of \  failed \ comparison) ) \times 1 + (1 \times ( Two \ successful \  comparisons) ) \bigg ) }

Total number of character comparison = ( (( 42 – 1) × 1 ) + ( 1 × 2) )

Total number of character comparison = 41 + 2

Total number of character comparison = 43

You might be interested in
A CPU has 32 KB cache, 2-way set associative, 16-byte block size. How many bits are required to use index each set in this cache
LenKa [72]

Answer:

10 bits

Explanation:

Cache size = 32 KB

We were also given that it is 2 way set associative

Block size = 16 bytes = 2^4 = 4 bits for offset

Number of blocks = cache size / block size = (32*2^10) / 16

=2^11

Hence, index = number of blocks / 2 (since 2 way associative)

=(2^11)/2 = 2^10 = 10 bits for index

7 0
3 years ago
A_____refers to the entire Excel file
Veronika [31]
Answer:  workbook

Explanation:
A workbook is the file that holds several worksheets.
The worksheets within a workbook can communicate with each other within the workbook or with other workbooks and their worksheets.
A worksheet within a workbook holds cells that are defined by rows and columns. Worksheets within a workbook can removed and new worksheets can be added.
8 0
3 years ago
Which of the following is NOT a possible combination of values of the variables in this program when it finishes running?
Nady [450]

Answer:

Definitely D

Explanation:

When you flip a coin it’s a 50/50 chance. Meaning it’s equal.

7 0
3 years ago
Read 2 more answers
Danny is editing the text content of a single page on a website he created a year ago. What part of the tag would he have to upd
Verdich [7]
<h2>"<lastmod>" is the right choice for the given scenario</h2>

Explanation:

<update> This tag does not belong to <URL> tag of the site map. Hence this option goes invalid.

<lastmod> This gives details of the date and time when the website content was changed. It will be in "W3C Date time format". This may omit time at times. This is the write answer.

<loc> This contains the URL of the web page.

<changefreq>: How frequently the "web page is likely to get modified". The  values which it accepts are: "monthly, always , daily , weekly ,hourly, yearly , never"

5 0
3 years ago
Fill in the blank: the final step of the dhcp discovery process is known as ______. Multiple choice, shuffle.
Ugo [173]

The configuration procedure moves into its final stage once the DHCP server has received the DHCPREQUEST message from the client. An acknowledgement packet, or DHCPACK, is sent to the client at this step.

<h3>What final step of the DHCP discovery process?</h3>

After selecting the proper IP address, the server sends the client an OFFER packet, and the client replies with a REQUEST packet. The process ends with the server sending an ACK packet to confirm that the client has received an IP address.

Therefore, DHCP may dynamically issue IP addresses to any Internet-connected device, node, or client computer.

Learn more about DHCP here:

brainly.com/question/28150867

#SPJ1

6 0
1 year ago
Other questions:
  • Consider the concept of cultural lag. Identify two American values that are “lagging.” What are three norms that are lagging? Ho
    11·1 answer
  • Which of these statements is true? Steve Jobs invented the mouse as an input device. Bill Gates invented the mouse as an input d
    6·1 answer
  • What your computer can do to you?
    14·2 answers
  • Which of the following is the correct ordering of operating systems, oldest to newest?
    5·2 answers
  • Suppose a host has a 1-MB file that is to be sent to another host. The file takes 1 second of CPU time to compress 50%, or 2 sec
    12·1 answer
  • The __________ operator increases the value of the variable by 1 after the original value is used in the expression in which the
    7·1 answer
  • An article explaining the uses of the parts of a computer​
    14·1 answer
  • which of the following can be represented by a sequence of bits. 1. An integer 2. An alphanumeric character 3. A machine languag
    12·1 answer
  • What is phishing?
    14·1 answer
  • The three main objectives of information security are
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!