Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Programming.. Backtracking.

Programming.. Backtracking.

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
5 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vafoqome
    wrote on last edited by
    #1

    Programming... :sigh:Backtracking. :sigh: I need help with backtracking question. In an election, five parties won and got A 20 B 14 C 30 D 16 E 40 In order to rule, a coalition of More than 60 must be negotiated. But we have restrictions: A does not sit with D C does not sit with E A B C D E A. 1 1 1 0. 1 B. 1 1. 1 1. 1 C. 1 1. 1 1. 0 D 0 1. 1 1. 1 E. 1. 1. 0. 1. 1 The function should return the number of possible coalitions.. Which is 3. As soon as the coalition is formed, no need to add more parties. A + E + B is not valid

    J L S P 4 Replies Last reply
    0
    • V vafoqome

      Programming... :sigh:Backtracking. :sigh: I need help with backtracking question. In an election, five parties won and got A 20 B 14 C 30 D 16 E 40 In order to rule, a coalition of More than 60 must be negotiated. But we have restrictions: A does not sit with D C does not sit with E A B C D E A. 1 1 1 0. 1 B. 1 1. 1 1. 1 C. 1 1. 1 1. 0 D 0 1. 1 1. 1 E. 1. 1. 0. 1. 1 The function should return the number of possible coalitions.. Which is 3. As soon as the coalition is formed, no need to add more parties. A + E + B is not valid

      J Offline
      J Offline
      jeron1
      wrote on last edited by
      #2

      Is there a specific issue? Could you post the code that you have tried?

      "the debugger doesn't tell me anything because this code compiles just fine" - random QA comment "Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst "I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle

      1 Reply Last reply
      0
      • V vafoqome

        Programming... :sigh:Backtracking. :sigh: I need help with backtracking question. In an election, five parties won and got A 20 B 14 C 30 D 16 E 40 In order to rule, a coalition of More than 60 must be negotiated. But we have restrictions: A does not sit with D C does not sit with E A B C D E A. 1 1 1 0. 1 B. 1 1. 1 1. 1 C. 1 1. 1 1. 0 D 0 1. 1 1. 1 E. 1. 1. 0. 1. 1 The function should return the number of possible coalitions.. Which is 3. As soon as the coalition is formed, no need to add more parties. A + E + B is not valid

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Exactly what help do you need?

        1 Reply Last reply
        0
        • V vafoqome

          Programming... :sigh:Backtracking. :sigh: I need help with backtracking question. In an election, five parties won and got A 20 B 14 C 30 D 16 E 40 In order to rule, a coalition of More than 60 must be negotiated. But we have restrictions: A does not sit with D C does not sit with E A B C D E A. 1 1 1 0. 1 B. 1 1. 1 1. 1 C. 1 1. 1 1. 0 D 0 1. 1 1. 1 E. 1. 1. 0. 1. 1 The function should return the number of possible coalitions.. Which is 3. As soon as the coalition is formed, no need to add more parties. A + E + B is not valid

          S Offline
          S Offline
          Stefan_Lang
          wrote on last edited by
          #4

          vafoqome wrote:

          A + E + B is not valid

          Is that an additional restriction? This combo looks perfectly valid to me - it fullfils all the requirements. As for backtracking, there's plenty of literature on that topic, and I'm sure lots of example codes as well. Other than that, what is your question?

          GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)

          1 Reply Last reply
          0
          • V vafoqome

            Programming... :sigh:Backtracking. :sigh: I need help with backtracking question. In an election, five parties won and got A 20 B 14 C 30 D 16 E 40 In order to rule, a coalition of More than 60 must be negotiated. But we have restrictions: A does not sit with D C does not sit with E A B C D E A. 1 1 1 0. 1 B. 1 1. 1 1. 1 C. 1 1. 1 1. 0 D 0 1. 1 1. 1 E. 1. 1. 0. 1. 1 The function should return the number of possible coalitions.. Which is 3. As soon as the coalition is formed, no need to add more parties. A + E + B is not valid

            P Offline
            P Offline
            Patrice T
            wrote on last edited by
            #5

            vafoqome wrote:

            I need help with backtracking question.

            Helping you is not solving the problem for you. Show your work so far, and explain problem you encounter.

            Patrice “Everything should be made as simple as possible, but no simpler.” Albert Einstein

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups