# Basics of Recursive Programming (recitation)

920 views

## Count Paths

Meet bugbug the Caterpillar.

Imagine bugbug is in an by grid. He starts at the bottom left corner, , and wants to end up at the top right corner .

Bugbug is only capable of moving right or up. Write a function count_paths that takes a grid length and width and returns the number of different paths bugbug can take from the start to the goal. (There is a closed-form solution to this problem, but try to answer it procedurally using recursion.)

Implement count_paths
// { autofold
package com.yourself;
public class CountPath {
// }
// Goal: count how many different paths one can take in order to get from
// the bottom left corner to the top right corner of a grid.
// Constraint: you can only move right or up.
// Parameters: eight and width correspond the size of a rectangle grid.
// REQUIRES: width >= 1 && height >= 1
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX