# CS 161 Lab 5

## Overview

This lab will explore and get good practice with recursion! We will be doing a few tasks, all using recursion - NO LOOPS ALLOWED!
- Creating recursive sequences
- Finding palindromes
- Printing star patterns

Here's the template for the code you need to write:
Recursion.java
## Lab Assignment

Please complete this lab individually. You are always welcome to bring any lab material and

questions to office hours.

### Assignment Overview

Recursion is essentially when a method calls itself, asking for the solution of a smaller instance of the problem.

Two things are vital when using recursion: a **base case** (or base cases) and the **recursive case**.

We will implement a couple of made-up number sequences using recursion (`pracSeq1` and `pracSeq2` in the template).
The desciptions for these sequences is provided as the postcondition for each method.

Next, we will implement the method palindrome(String test)

that accepts a string and returns true or false depending on whether it is a palindrome or not. You can use any method of the String class that you think will be useful.

Your TA will guide you in solving this problem.
Next, complete the code for a method sequence3(int n)

similar to the examples above. It returns the value of index n, where each value is one half of the predecessor value plus 3 times the predecessor value.
Lastly, complete the code for creating a star pattern. There are two methods tha work together here. The starString(int x)

method is a recursive method that returns a string with the appropriate number of stars to starPattern(int x)

to be printed.

EXAMPLE OUTPUT IF X == 5:

*****
****
***
**
*

Both of these must be recursive and cannot use loops. Think about what the base cases are and what the recursive case is.

This recitation is worth two points