#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Posts
    2
    Rep Power
    0

    Question Recursive function


    Please help me, I need to write a recursive function that accepts two strings one arr and a word, and checks whether the word contained in the string arr, not necessarily in sequence. If the word consist of more than three letters and i <j <k are the indexes of the three characters that appear in the word and in arr the following condition should exist k-j<=2*(j-i). For example arr="do no good", word= "dog" There are two options:
    - do no g
    - do no g
    But only the latter satisfies the condition.
    the function returnes the containing length. in this example its 7.

    i can use exepet of this function two more recursive help function. i cant use loops or pointers
  2. #2
  3. No Profile Picture
    Brony & F/OSS Advocate
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2003
    Location
    Anaheim, CA (USA)
    Posts
    6,649
    Rep Power
    2478
    This definitely sounds like a homework question of some sort, and we won't do the problem for you. However, we will help if you are having trouble with something specific about it. What code have you tried so far? Is there a specific issue with this question you're not able to solve?
    ~~ Peter ~~ :: ( Who am I? ) :: ( Peter's Musings: Uploading myself, bit by bit... ) :: ( Electronic Frontier Foundation ) :: ( I'm a GNU/Linux addict and Free Software Advocate. ) :: ( How to Ask Questions the Smart Way ) :: ( The Fedora Project, sponsored by Red Hat ) :: ( GNOME: The Free Software Desktop Project ) :: ( GnuPG Public Key ) :: ( About me on the WIki )
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Posts
    2
    Rep Power
    0

    exam


    I have a test soon and im solving questions and old exams to Prepare myself. I came across this problem and I have no idea for​​an algorithm that is suitable...I'm really stuck...

IMN logo majestic logo threadwatch logo seochat tools logo