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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:32:48+00:00 2026-05-20T09:32:48+00:00

I want to design an algorithm that determines whether an array A is plural,

  • 0

I want to design an algorithm that determines whether an array A is plural, and return that element.

An array is plural when there exists an element x in the array if more than half of the array is the same as x.

I am wondering if there is a more efficient divide and conquer algorithm that runs better than the current one i have now.

Assume you have the array

aaabbcac

i will recursively split the array up until i get subarrays of size 2, as follows.

aa ab bc ac

from here, i will compare each element in the SUBARRAY to see if they are equal:
If EQUAL, return the element,
Else, return false.

aa ab bc ac 
a  f   f  f

so now i have an array of the element A and 3 false.

i was thinking of combining them like so:

a  f  f  f
  a     f  <----- combining a and f will give a
     a    <----- returns a

But, if we look at the array, we have 4 A’s, which does not fulfill the criteria of a plural array. It should return false, should the array not be a plural array.

I believe my algorithm will run in O(n lgn), should it be a correct algorithm, which unfortunately is not.

Can anyone point me in the right direction for this?

  • 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-20T09:32:49+00:00Added an answer on May 20, 2026 at 9:32 am

    This is a problem of counting number of occurrences of x. Split the array into sub arrays and send the x along with sub arrays. Return count, sum counts and check if it’s greater then the size of the array.

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

Sidebar

Related Questions

That's my question, I want design all the interface of my application within an
I want to design Delphi plugin framework. There are three options: 1. DLL 2.
I want to design a webpage as shown in the image below. There are
I want to design a web page with a banner and an iframe. I
Say I want to design a database for a community site with blogs, photos,
I am new to this. I want to design an image gallery in my
How do I send an SMS to Active Directory Users. I want to design
I am new to C# and .NET programming. I want to design an application
I want to see if anyone has a better design for a class (class
You and I want to be the expert on computer programming or website design,

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.