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. Generic algorithm question

Generic algorithm question

Scheduled Pinned Locked Moved C / C++ / MFC
questionalgorithmshelp
2 Posts 2 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.
  • A Offline
    A Offline
    Ashish Ranjan Mishra
    wrote on last edited by
    #1

    Hello, I need to find out a solution for below problem, can anyone please let me know what is the best algorithm for this problem, I have to distribute sweets among 3 persons let A,B, C with no 5,3,2 respectively so total 10 sweets I have to distribute among these 3 without repeating again(if A has given then next time B or C but A should not come again). so the sequence can be like as below, Sol1: C,B,C,B,C,A,C,A,C,B Sol2: B,C,A,C,B,C,B,C,A,C Please let me know if any algorithm I can use for this problem Thanks

    asdsa

    D 1 Reply Last reply
    0
    • A Ashish Ranjan Mishra

      Hello, I need to find out a solution for below problem, can anyone please let me know what is the best algorithm for this problem, I have to distribute sweets among 3 persons let A,B, C with no 5,3,2 respectively so total 10 sweets I have to distribute among these 3 without repeating again(if A has given then next time B or C but A should not come again). so the sequence can be like as below, Sol1: C,B,C,B,C,A,C,A,C,B Sol2: B,C,A,C,B,C,B,C,A,C Please let me know if any algorithm I can use for this problem Thanks

      asdsa

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Ashish Ranjan Mishra wrote:

      I have to distribute sweets among 3 persons let A,B, C with no 5,3,2 respectively so total 10 sweets...

      :confused:

      "One man's wage rise is another man's price increase." - Harold Wilson

      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

      "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

      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