American Computer Science League Junior Division 2007 - 2008 Contest #4

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 2

ACSL

2007 - 2008 American Computer Science League Contest #4


Junior Division
Trees

PROBLEM: Given an input string, create the binary search tree for the string using the
rules provided in the ACSL description booklet.

INPUT: There will be 5 lines of input. Each line will contain a string of alpha characters
and a positive integer.

OUTPUT: For each input line, print the depth of the character at the position in the string
given by the positive integer using the definition provided in the ACSL description
booklet.

E U

C R S V

C E I S U

F N T

I N O

SAMPLE INPUT SAMPLE OUTPUT

1. RECURSIVEFUNCTIONS, 1 1. 0
2. RECURSIVEFUNCTIONS, 6 2. 2
3. RECURSIVEFUNCTIONS, 10 3. 4
4. RECURSIVEFUNCTIONS, 15 4. 5
4. RECURSIVEFUNCTIONS, 18 5. 3
ACSL
2007 - 2008 American Computer Science League Contest #4
Junior Division
Trees

TEST DATA

TEST INPUT TEST OUTPUT

1. BALTIMORE, 6 1. 3
2. MARYLAND, 4 2. 2
3. THIRTYYEARS, 9 3. 3
4. MARRIOTTSRIDGE, 13 4. 5
5. BINARYSEARCHTREE, 4 5. 1

You might also like