Like Tree1Likes
  • 1 Post By Salem

i dont know where to start!!!

This is a discussion on i dont know where to start!!! within the C++ Programming forums, part of the General Programming Boards category; i have this program assignment and i dont know how to approach it: Golden Strings can be defined by the ...

  1. #1
    Registered User
    Join Date
    Nov 2011
    Posts
    1

    i dont know where to start!!!

    i have this program assignment and i dont know how to approach it:

    Golden Strings can be defined by the following (recursive) scheme.
    G0= “a”; G1=”b”; and
    Gk = Gk-1 + Gk-2; for k>=2.

    Thus, G2 = G1 + G0 = “b” + “a” = “ba”,
    G3 = G2 + G1 = “ba” + “b” = “bab”,
    And, G4 = G3 + G2 = “bab” + “ba” = “babba”,

    Write a program that will print G10.

    Now i know i can do a while or a for loop...

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,338
    > Gk = Gk-1 + Gk-2; for k>=2.
    Looks just like this -> Fibonacci number - Wikipedia, the free encyclopedia

    The internet is knee-deep in recursive Fibonacci implementations.
    rags_to_riches likes this.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. I dont Know
    By jturner38 in forum C Programming
    Replies: 3
    Last Post: 04-11-2009, 09:51 PM
  2. dont know were to start
    By kaijuu in forum C Programming
    Replies: 7
    Last Post: 02-19-2008, 02:30 AM
  3. I just dont get it could somebody help
    By zergdeath1 in forum C++ Programming
    Replies: 9
    Last Post: 10-21-2003, 06:43 PM
  4. if you dont like linux threads, dont read...
    By ... in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 02-03-2003, 10:26 AM
  5. dont know where to start!! help
    By playboy1620 in forum C Programming
    Replies: 1
    Last Post: 02-24-2002, 09:07 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21