0% found this document useful (0 votes)
25 views1 page

C 4 JR

The document contains a series of programming and data structure problems from the American Computer Science League Junior Division contest for 2007-2008. It includes questions on binary search trees, stack operations, evaluating prefix expressions, translating infix to postfix expressions, and analyzing a program's output for unique letters. Each question tests different aspects of computer science concepts and programming logic.

Uploaded by

CK
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views1 page

C 4 JR

The document contains a series of programming and data structure problems from the American Computer Science League Junior Division contest for 2007-2008. It includes questions on binary search trees, stack operations, evaluating prefix expressions, translating infix to postfix expressions, and analyzing a program's output for unique letters. Each question tests different aspects of computer science concepts and programming logic.

Uploaded by

CK
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

ACSL

2007 - 2008 American Computer Science League Contest #4


Junior Division

1. Data Structures
What is the depth of the binary search tree for
WILLIAMSHAKESPEARE?

2. Data Structures
Given an initially empty stack and the following sequence of operations,
what would be the next POPPED element?

PUSH(M), PUSH(A), PUSH(C), POP(X), PUSH(B), POP(X), POP(X),


PUSH(E), PUSH(T), PUSH(H), POP(X)

3. Prefix-Infix-Postfix
Evaluate the following prefix expression :
Note: all numbers are single digits in the expression

+/+452–41*2+84

4. Prefix-Infix-Postfix
Translate the following infix expression to postfix:

A
+C∗B 2
B

5. What Does this Program Do?


How many unique letters are there in the output of the following program
after execution?

N$="" M$=""
A$="MISSISSIPPIMISSOURIRIVERS"
FOR I = 1 TO (LEN(A$) - 1) STEP 2
IF MID$(A$, I, 1) = MID$(A$, I + 1, 1) THEN N$ = N$+ MID$(A$, I, 1)
IF MID$(A$, I, 1) > MID$(A$, I + 1, 1)
THEN N$ = N$ + MID$(A$, I + 1, 1) + MID$(A$,I, 1)
NEXT I
FOR J = 1 TO LEN(N$)
IF ((MID$(N$, J, 1)>"E") AND (MID$(N$, J, 1) <= "M"))
THEN M$ = M$ + MID$(N$, J, 1)
NEXT J
PRINT M$
END

You might also like