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
Norma-Jean [14]
3 years ago
5

Given a collection of n nuts and a collection of n bolts, arranged in an increasing order of size, give an O(n) time algorithm t

o check if there is a nut and a bolt that have the same size. The sizes of the nuts and bolts are stored in the sorted arrays NUT S[1..n] and BOLT S[1..n], respectively. Your algorithm can stop as soon as it finds a single match (i.e, you do not need to report all matches).
Computers and Technology
1 answer:
kari74 [83]3 years ago
8 0

Answer:

See explaination

Explanation:

Keep two iterators, i (for nuts array) and j (for bolts array).

while(i < n and j < n) {

if nuts[i] == bolts[j] {

We have a case where sizes match, output/return

}

else if nuts[i] < bolts[j] {

this means that size of nut is smaller than that of bolt and we should go to the next bigger nut, i.e., i+=1

}

else {

this means that size of bolt is smaller than that of nut and we should go to the next bigger bolt, i.e., j+=1

}

}

Since we go to each index in both the array only once, the algorithm take O(n) time.

You might be interested in
An electronic spreadsheet is a type of<br> archive.<br> database.<br> document.<br> periodical.
zhenek [66]

Answer:

The answer is "database"

Explanation:

The spreadsheet is an application program, that is used to organized, analysis, and store data in tabular format. It is also used to import data and provide a database in programming that is used to store data and other option is not correct that can be described as follows:

  • Archive uses VBA that stands for "Visual Basic for Applications", it is used to store data in an archive file, that's why it is not correct.
  • Document is a file that is used to store data, that's why it is not correct.
  • Periodical use graph and bar charts to display data graphically, that's why it is not correct.

7 0
3 years ago
Read 2 more answers
How do you copy a file​
trasher [3.6K]

Answer:

right click and press control c

8 0
3 years ago
Wi-Fi Protected Access (WPA) fixes critical vulnerabilities in the earlier wired equivalent privacy (WEP) standard. Understandin
Mars2501 [29]

Since Wi-Fi Protected Access (WPA) fixes critical vulnerabilities in the earlier wired equivalent privacy (WEP) standard, the attacks that is related to encrypted wireless packets is option A: IV attacks.

<h3>Describe an IV attack.</h3>

A wireless network attack is called an initialization vector (IV) attack. During transmission, it alters the IV of an encrypted wireless packet. One packet's plaintext can be utilized by an attacker to calculate the RC4 key stream produced by the IV employed.

Note that A binary vector used to initialize the encryption process for a plaintext block sequence in order to boost security by adding more cryptographic variance and to synchronize cryptographic hardware. The initialization vector is not required to be kept secret.

Learn more about Wi-Fi Protected Access  from

brainly.com/question/13068630
#SPJ1

See full question below

Wi-Fi Protected Access (WPA) fixes critical vulnerabilities in the earlier wired equivalent privacy (WEP) standard. Understanding that WPA uses a combination of an RC4 stream cipher and Temporal Key Integrity Protocol (TKIP), this makes a wireless access point NOT vulnerable to which of the following attacks when related to encrypted wireless packets?

IV attacks

Malware

Ransoware

5 0
1 year ago
Give 5 examples for software ​
yuradex [85]

Answer:

  • Adobe Photoshop.

  • Picasa.

  • VLC Media Player.

  • Windows Media Player.

  • Windows Movie Maker

3 0
3 years ago
What is Computer categories
MA_775_DIABLO [31]
Computer Categories are like

Supercomputers, mainframe computers, microcomputers, mobile computers, minicomputers.

I hope that this is the type of answer that you were looking for.
5 0
3 years ago
Other questions:
  • Numeric data is stored in ___________ for direct processing.
    10·2 answers
  • List of programming languages and their typing
    5·2 answers
  • . A register in a computer has a of bits. How many unique combinations can be stored in the register?
    5·1 answer
  • What allows a person to interact with web browser software?
    13·2 answers
  • What is the full word of"VPN"?​
    15·2 answers
  • Using the notation exemplified in following question , list a set of tables and attributes (and identify keys) to represent the
    10·1 answer
  • The M:N relationship between STUDENT and CLASS must be divided into two 1:M relationships through the use of the ENROLL entity;
    10·2 answers
  • . What type of computer implementation does the following code represent? Load A,10 Load B,1:5 Add A,B STORE A, [20]
    5·1 answer
  • Something I should look for when trying to decide if a source is credible is the publication's ....
    10·1 answer
  • What is pollution?
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!