Enrol to start learning
Reading is open to everyone. Enrolling is free, and it is what unlocks the audio lessons, practice tests and progress tracking.
20.4.1. Formulation of Valid Strings
This section
Practice test
10 questions on this section. Wrong answers show you what to read again.
Sign up to take itWhole chapter
Revision test
Mixed questions from across the chapter. Your answers get marked.
Sign up to take itQuick
Flashcard drill
2 cards from this lesson. Good the night before a test.
Try these first
- 1.
Define a valid string in the context of parentheses.
Hint
Think about matching pairs.
- 2.
Provide two examples of valid strings.
Hint
Focus on balanced pairs.
- 3.
What is the definition of a valid parenthesis string?
- A string that is completely empty
- A string where each '(' matches a ')'
- A string with more ')' than '('
Hint
Think about what makes a string valid!
- 4.
True or False: The formula C(n) = ∑C(k)C(n-k-1) is a recurrence relation for Catalan numbers.
- True
- False
Hint
Recall the formation of the recurrence.
- 5.
Create and describe a new problem related to valid parenthesis without violating the matching condition.
Hint
Think about restrictions on placement.
- 6.
Propose an algorithm to count valid strings of n parenthesis using dynamic programming.
Hint
Look into how states can be represented.
Exercises
Total Questions
2
Estimated Time
4 min
Passing Score
70%
Instructions
- Read each question carefully
- You can use hints if you need help
- Complete all questions before submitting
4 more questions available
Enrol freeQuiz
Total Questions
2
Estimated Time
4 min
Passing Score
70%
Instructions
- Read each question carefully
- You can use hints if you need help
- Complete all questions before submitting
Get your answers marked and your progress tracked
Enrol freeChallenge Problems
Total Questions
2
Estimated Time
4 min
Passing Score
70%
Instructions
- Read each question carefully
- You can use hints if you need help
- Complete all questions before submitting