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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:46:15+00:00 2026-06-13T18:46:15+00:00

Preface Consider a list, array or string of 12 elements, of an irrelevant value

  • 0

Preface

Consider a list, array or string of 12 elements, of an irrelevant value (lets say E). Each element can be linked to, at most, one other adjacent element, or if it is the last element of the list, it can be linked to the first element.

Examples of valid lists, where dashes indicate links, and “E” represents an element.

E E E E E E E E E E E E 
E E-E E-E E E E-E E-E E
E E E-E E E-E E-E E E E-

An example of an invalid list.

E-E-E E E E E-E E E E E-

Question

I want to calculate the total number of unique lists, and print them.

To approach this problem, what might be the best way to represent the data?

Would it be best to implement a data structure specific to this problem?

I am looking to implement this in Java, but if you believe that a different language is better suited, I am open to suggestions.

Why

This is NOT a homework question.

The idea is to find every rhythmic pattern in a bar of 12/8 consisting of only single and double groupings of eighth notes, of which can be tied across a barline.

  • 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-13T18:46:16+00:00Added an answer on June 13, 2026 at 6:46 pm

    Calculating the number of possibilities here actually has an incredibly neat solution (in my opinion).

    Notice that for n notes, the number of possible connections ( C(n) ) if the first note is connected to the second is C(n-2). Otherwise it is C(n-1). This means that

    C(n) = C(n-1) + C(n-2)
    C(1) = 3 //Either the first and second are connected, 
             //neither are connected, or the end is connected.
    C(0) = 2 //Either the end is connected or it isn't
    

    Note: If the last note in a single note example can be connected “to itself” G(0) is 1 Otherwise, it is 0. In addition I am unclear whether E-E and E E- are separate, if they aren’t then, C(1) is 2 not 3. Note these only apply for sequences of 0 or 1 on their own you’d have to have an if statement outside of the actual function C(n) to return 1 instead of 2. Otherwise it screws up the whole recurrence. A bit messy, but that’s the nature of real world data in algorithms

    This means you’ve basically got a variant on the fibonacci series! Cool right?

    Data Representation

    I would have a list of n booleans. An array would work fine. If 2 notes are connected, then that entry in the array should be true. I would have index 0 be the connection be the first and second notes, and index n-1 be whether or not the last note is connected to anything.

    Permutation Generation

    The way in which we calculate the total number of possibilities lends itself nicely to a generation method (G(n)). For n we need to tack on E-E to G(n-2) and E to G(n-1).

    At the base of this recurrence we have:

    G(0) = {E, E-} 
    G(1) = {E-E, E E, E E-}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Preface: I consider myself slightly effective in ruby on rails, and a complete novice
Preface: I'm know that in most cases using a volatile field won't yield any
Preface We are providing customers with our service API. Each customer has own subdomain
Preface: I know this is an unusual/improper way to do this. I can do
Preface I have three tables Customers, Individuals & Companies and a customer can be
To preface this question I should say I know very little about database efficiency
Preface: I am 100% new to the Flash and ActionScript world, doing research for
Preface : I am new to the iPhone SDK, Obj-C, Interface Builder and Cocoa.
Preface : I'm honestly not sure if this should be on StackOverflow, SuperUser or
Preface: I'm a big fan of Netbeans for Rails development. I'm just starting my

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.