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 8480423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:17:27+00:00 2026-06-10T19:17:27+00:00

Just a quick question. Which option would be more efficient? Sorting a 2D array

  • 0

Just a quick question.

Which option would be more efficient?

  1. Sorting a 2D array (Each value in the 1st dimension of the array is linked to the value in the 2nd so they must be sorted equally [value and ID number] ).

or

  1. Sort a 1D array and then compare(using linear search) values against another set of values to check if they match (in order to find which ID number corresponds to each value).

All values are guaranteed to be different so there is no problem with duplication of numbers. Even if there was it wouldn’t matter.

Is there a way of finding out how efficient both methods are in the debugger?

Thank you all for your time. =]

Seb

  • 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-06-10T19:17:29+00:00Added an answer on June 10, 2026 at 7:17 pm

    I think using the 2D array sorting technique with the help of using a comparator will be much more efficient. In this technique , the array is sorted in one go by just one unit of comparison for each 2D array and in the 2nd approach you are first sorting the 1D array and then again searching to map the associated values.

    example : sorting 2D array of String in java

    You can try out the time required for sorting yourself by printing the timestamp before sorting and after sorting for both above approaches.

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

Sidebar

Related Questions

Just a quick question, how would one map a primary key which must be
Just a quick question, I have a figure which contain an image and a
Just a quick question here. I have a program in which I need to
Just a quick question, on which I cannot find a good reference, especially with
just a quick question. I've got this table in a Word template which have
just a quick question.. Could you suggest me an option how to design and
I just wrote this exam, in which there was question: Consider a array of
Just a quick question. I have a system which contains some silverlight elements to
just a quick question , your code does add up bits to numbers which
Hi just a quick question here I got an account on www.assembla.com which is

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.