Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4102522
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:50:17+00:00 2026-05-20T20:50:17+00:00

I have some problem in my homework, I’m given two arrays A,B (they are

  • 0

I have some problem in my homework, I’m given two arrays A,B (they are sorted) with n elements each one, I need to find (n*logn) minimal elements (or n if it is possible) from the array which cosists of elements which is sum of one element from array A and one element from array B, total number of elemnts in C will be n^2, – C = {a+b | a belongs to A, b belongs to B}, I need to make it with complexity O(n*logn).
Thanks in advance for any help!

P.S. I tried to solve it but I have some problems. I know that the first element will be a1 + b1, a1 first element from A, b1 first element from B.

edited

Also all elements in C are different.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T20:50:17+00:00Added an answer on May 20, 2026 at 8:50 pm

    I’m not giving you the answer, but here are a few hints to get you thinking in the right direction.

    So let’s say you have. Keep in mind that these lists are already sorted, this is very important.
    {a1,a2,a3}
    {b1,b2,b3}

    As you correctly said, the first element is a1+b1. Why? Because those are the smallest numbers in both arrays, so their sum will be the smallest.

    Now what options do you have for the second element? Remember that the list is sorted!
    Could it be a1+b2?
    Could it be a1+b3?
    And then for the opposite,
    Could it be b1+a2?
    Could it be b1+a3?

    Could it be b2+a2?
    (two yes answers and three no answers above)

    Using this you should be able to figure out how you find the second smallest element and from here it should be easy to find how to do that for all elements.

    If you are still confused, ask questions in the comments.

    GL!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need some help with one of the questions from my homework, Ive been
This is a homework problem that I have. I have been doing some research
I have a situation in Python(cough, homework) where I need to multiply EACH ELEMENT
I am learning Ruby and have to do some homework, but have problem with
I have some problem with my code public IQueryable<PageItems> GetPageById(Guid Id) { var xml
I have some problem with Jquery Autocomplete plugin ( http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/ ) I got it
I have some problem with my .htaccess file. Here I am adding my problem.
I have some problem to order an array by a field of this, here
I have some problem whith such mysql_query INSERT INTO table VALUES ('', CURDATE()-1) why
I have some problem's with a simple application in JSF 2.0. I try to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.