Thread: i dont know where to start!!!

  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 int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > 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.
    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.

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, 03: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, 11:26 AM
  5. dont know where to start!! help
    By playboy1620 in forum C Programming
    Replies: 1
    Last Post: 02-24-2002, 10:07 AM