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

  • Home
  • SEARCH
  • 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 9149361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:28:00+00:00 2026-06-17T11:28:00+00:00

how to get all the possible ways in which positions of array can be

  • 0

how to get all the possible ways in which positions of array can be picked?
for ex for array of size 2 there are 3 possibilities first element, second element and both the elements.
for array of size 3 possibilities are first, second, third,first and second, first and third, second and third,and finally first second and third.
i want a simple nested loops for it..

  • 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-17T11:28:00+00:00Added an answer on June 17, 2026 at 11:28 am

    Nested loops aren’t really the answer here, because the depth of nesting would depend on the size of the array.

    So you think in binary: the subsets of the size-N array correspond to the non-zero binary numbers of the right length, so do something like

    for (int subset_c = 1; subset_c < (1<<N); subset_c++)
    {
        { start thinking about a new subset }
        for (int j=0; j<N; j++)
        {
             if ((subset_c>>j)&1) { the subset should contain array[j] }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What are all the possible ways in which we can get memory leaks in
Is there a way to get all possible values from a MySQL enum column?
Possible Duplicate: How to get all of the IDs with jQuery? How can i
I would like to get all possible available currencies. Java 7 had provided such
Is it possible to get all 7 days for a given date using linq
Is it possible to get all div's within a page using jQuery including nested
Is it possible to get all/latest tweets from twitter public list? Example list: https://twitter.com/#!/thecaucus/u-s-senate
Possible Duplicate: Get all files from VSS for a given date? I need to
I'm wondering if it is at all possible to get the total duration of
I would like to be able to get a list of all possible files

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.