1 / 9

Lynbrook Computer Science

Lynbrook Computer Science. December 1, 2008. Announcements. USACO this week! (December 5-8) First ACSL: Monday, December 15 Two new competitions: CML (Continental Mathematics League) JAVA Computer Contest IPSC (Internet Problem Solving Contest).

umay
Download Presentation

Lynbrook Computer Science

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lynbrook Computer Science December 1, 2008

  2. Announcements • USACO this week! (December 5-8) • First ACSL: Monday, December 15 • Two new competitions: • CML (Continental Mathematics League) JAVA Computer Contest • IPSC (Internet Problem Solving Contest)

  3. CML (Continental Math League) JAVA Computer Contest • Done in JAVA • Done in teams • Written Contest • Based on AP Computer Science A/B curriculum • 25 Questions • 40 Minutes • Sometime between 4/20 and 5/1

  4. IPSC (Internet Problem Solving Contest) • Online contest • Done in teams of 3 • 5 Hours • Any language can be used • Access to online resources is allowed • USACO-like problems

  5. Tested Material on the ACSL What does this program do? Number Systems (different base operations) Recursive Functions (f(x) = f(x-1) + 1) Boolean Algebra (not A + B = …) Bit String Flicking (right shift, left shift) LISP Evaluation (ADD, SUB, etc.) Digital Electronics (AND, OR, XOR, NAND, NOR, XNOR) Prefix/Infix/Postfix Notation (+ 3 4) Data Structures (heaps, binary trees, stacks, etc.)

  6. Recursive Functions • Find f(15) given the following: • f(x) = • 2 * f(x-3) – 4 [if x is composite] • x2 + x [if x is prime]

  7. Solution • f(15) = 2 * f(12) – 4 • f(12) = 2 * f(9) – 4 • f(9) = 2 * f(6) – 4 • f(6) = 2 * f(3) – 4 • f(3) = 32 + 3 = 12 • Work backwards to get f(6) = 20, f(9) = 36, f(12) = 68, and f(15) = 132

  8. LISP • Evaluate the following: • (CDR (CDR (CAR (CDR ‘(2 ((3 (4 5) 6) 7)))))) • Hint: • CDR ‘((x) y) = y • CAR ‘((x) y) = (x)

  9. Solution • Work from the inside out: • (CDR '(2 ((3 (4 5) 6) 7))) = (((3 (4 5) 6) 7)) • (CAR '(((3 (4 5) 6) 7))) = ((3 (4 5) 6) 7) • (CDR '((3 (4 5) 6) 7)) = (7) • (CDR '(7)) = () • Answer: () or nil  PARENTHESIS ARE REQUIRED!!!

More Related