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
Blababa [14]
3 years ago
7

You are given two sorted arrays, each of size n. Give as efficient an algorithm as possible to find the k-th smallest element in

the union of the two arrays. What is the running time of your algorithm as a function of k and n?
Computers and Technology
1 answer:
Makovka662 [10]3 years ago
6 0

Answer:

# Program to find kth element  

# from two sorted arrays  

def kth(arr1, arr2, m, n, k):  

 

sorted1 = [0] * (m + n)  

i = 0

j = 0

d = 0

while (i < m and j < n):  

 

 if (arr1[i] < arr2[j]):  

  sorted1[d] = arr1[i]  

  i += 1

 else:  

  sorted1[d] = arr2[j]  

  j += 1

 d += 1

while (i < m):  

 sorted1[d] = arr1[i]  

 d += 1

 i += 1

while (j < n):  

 sorted1[d] = arr2[j]  

 d += 1

 j += 1

return sorted1[k - 1]  

# driver code  

arr1 = [2, 3, 6, 7, 9]  

arr2 = [1, 4, 8, 10]  

k = 5;  

print(kth(arr1, arr2, 5, 4, k))  

The running time will be  O(n)  and O(log k)

You might be interested in
_________________ ___________________ is an encrypted code that a person, website, or organization attaches to an electronic mes
Blizzard [7]

Answer:

Digital Signature

Explanation:

Digital Signatures are used in electronic messages to verify the sender's ıdentity. It is a online signature and highly secure way of proving identity.

The Signature is <em>encrypted</em> and can be decoded using <em>public-key</em> .

Digital signatures are certificated uniquely from accredited providers, encrypted and can be validated by certificate authorities.

Messages with digital signatures prove that the message sent by the owner of the signature and didn't changed on the way.

4 0
4 years ago
What is the BCC feature used for?
exis [7]

Answer:

to send an email to someone without revealing that person’s email address to others on the distribution list

Explanation:

BAM

7 0
3 years ago
Read 2 more answers
What technique involves graphical methods and nontechnical language that represent the system at various stages of development a
Mnenie [13.5K]

Answer:

The answer to this question this "modeling".

Explanation:

In this question, the answer is modeling because in system design we use System Analysis and Design(SAD). It is the most important subject in any software design like a mobile application, website, web pages, etc. In this subject, there is an important topic that is SDLC. The term SDLC stands for systems development life cycle or it is also known as the software development life cycle. It is a conceptual modeling used in project management that describes the stages involves the information for system development project. It maintenance the complete application. SDLC applied to technical and non-technical systems. In the SDLC many phases can be given as:

Requirement gathering and analysis:

In this phase, all the relevant information is collected from the customer to develop a product as their expectation.

Design:

In the design phase, the requirement gather by the software requirements specification (SRS) in a document that is used for software architecture.

Implementation or coding:

After completing the design phase we implement/coding in that section like User input validation, admin work, payment management, etc.

Testing:

In this section, we test all the things in software before hand over to the customer.

Deployment:

In this section after completing the testing successfully. it goes to the deployment section in this section production environment or User Acceptance testing is done depending on the customer expectation.

Maintenance:

In the maintenance section when the product is hand over customer and in future if any issue comes up and needs to be fixed or there is any Up-gradation is needed So it is done by the developers.

In computer science, any development is done on modules. So the answer to this question is modeling.

3 0
4 years ago
What is the full form of RPM in computer ​
alex41 [277]

Full from of RPM in computer is Revolutions Per Minute.

4 0
3 years ago
Read 2 more answers
If you have defined a class named SavingsAccount with a public static data member named numberOfAccounts, and created a SavingsA
Anvisha [2.4K]

Answer:

numAccounts = SavingsAccount.numberOfAccounts

Explanation:

In object oriented programming, when you have created an object of class, you can create several instances (objects) from that class by referencing the className.classFeild. In this instance SavingsAccount is the class name and

numberOfAccounts is a feild (or data member). to create a new numAccount, we use the syntax as above in the answer

3 0
4 years ago
Other questions:
  • The set of specific, sequential steps that describe exactly what a computer program must do to complete the work is called a(n _
    14·1 answer
  • Unix/linux are ____ systems, which let many people simultaneously access and share the resources of a server computer.
    13·1 answer
  • To find temporary windows files begin by typing in the search box
    6·1 answer
  • A typical, small, dry cell battery has a voltage of A. 6.0 volts. B. 1.0 volts. C. 12.0 volts. D. 1.5 volts.
    11·2 answers
  • Is it better to meet online or offline<br> (Please answer QUICK)<br><br> Thanks :')
    5·2 answers
  • In a CPMT, a(n) ____ should be a high-level manager with influence and resources that can be used to support the project team, p
    10·1 answer
  • You just bought a hard drive, you plan on using this a secondary storage, once installed, what needs to be done to the drive and
    6·1 answer
  • What does it mean to catch an exception?
    8·1 answer
  • Help me pls...
    7·2 answers
  • Which wireless standard runs on both the 2.4 and 5 GHz frequencies?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!