<jupyter_start><jupyter_text>Frog Jump AlgorithmFrog Jumps algorithm is part of the greedy algorithms.  The frog begins at position 0 in the river.  Its goal is to get to position n.  There are lilypads at various positions.  There is always a lilypad at position 0 and position n.  The frog can jump at most r units at a time.  The goal for this algorithm is to find the path the frog should take to minimize jumps, assuming a soultion exits.<jupyter_code># Define JumpStep function, which the frog can only jump two lilypads max (r = 2)
def JumpStep(n):
    if n == 1:
        return 1
    elif n == 2:
        return 2
    else:
        return JumpStep(n-1)+JumpStep(n-2)
for i in range(1, 10):
    print(i, 'Lilypads has', JumpStep(i), 'many ways of jump.')
# Define JumpStep function, where the frog can jump three lilypads max (r = 3)
def JumpStep(n):
    if n == 1:
        return 1
    elif n == 2:
        return 2
    elif n == 3:
        return 3
    else:
        return JumpStep(n-1)+JumpStep(n-2)+JumpStep(n-3)
for i in range(1, 10):
    print(i, 'Lilypads has', JumpStep(i), 'many ways of jump.')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08851884312007012, 'fraction_numerical': 0.021910604732690624, 'mean_word_length': 3.007017543859649, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '384701', 'license': 'MIT', 'n_tokens_mistral': 410, 'n_tokens_neox': 371, 'n_words': 165, 'path': 'Notebook_Files/.ipynb_checkpoints/frog_jump-checkpoint.ipynb', 'repo_name': 'NormanLo4319/Algorithm', 'size': '1141'}