# How it Works

Browse Certified Peer Tutors (44 Reviews, 4.96 Stars, ECS 32A, ECS 60…)

Meet Up On-Campus

Time, Pay, and Review In-App

# Top Session Locations

Shields Library

Engineering Library

Tercero Residence Halls

# Top Courses

ECS 32A

ECS 32B

ECS 60

Browse Certified Peer Tutors (44 Reviews, 4.96 Stars, ECS 32A, ECS 60…)

Meet Up On-Campus

Time, Pay, and Review In-App

Shields Library

Engineering Library

Tercero Residence Halls

ECS 32A

ECS 32B

ECS 60

Featured

Stack is a data structure that follows the property of **F**irst **I**n **L**ast **O**ut (**FILO**). So the first element inserted into a stack will be the last element deleted from the stack. You can think of a stack as a stack of dishes. The first dish that goes into the stack will be the last one to be used.

The problem is: Given **N** pairs of parentheses, write a function to generate all combinations of well-formed parentheses. The naive solution is to generate all combinations of **N** pairs of parentheses, then checking if each one is valid.

Recursion occurs when a function calls

itself. Recursion is useful when dealing with problems that have recursive properties. Consider a functionfactorial(n)that returns the factorial ofn. This function can be defined recursively becausefactorial(5) = 5 * factorial(4) = 5 * 4 * factorial(3)and so on.