lynbrook computer science n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Lynbrook Computer Science PowerPoint Presentation
Download Presentation
Lynbrook Computer Science

Loading in 2 Seconds...

play fullscreen
1 / 12

Lynbrook Computer Science - PowerPoint PPT Presentation


  • 196 Views
  • Uploaded on

Lynbrook Computer Science. Member Meeting, November 10, 2008. Upcoming Competitions. Today: USACO November Round 11/12 (Wed): TopCoder SRM Round 12/5-12/8 (Fri-Mon): USACO December Round 12/15 (Mon): ACSL Contest #1 Check http://LynbrookCS.com for full ACSL and USACO schedules!.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Lynbrook Computer Science' - micah


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
lynbrook computer science

Lynbrook Computer Science

Member Meeting, November 10, 2008

upcoming competitions
Upcoming Competitions
  • Today: USACO November Round
  • 11/12 (Wed): TopCoder SRM Round
  • 12/5-12/8 (Fri-Mon): USACO December Round
  • 12/15 (Mon): ACSL Contest #1
  • Check http://LynbrookCS.com for full ACSL and USACO schedules!
tested material on the acsl
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, DIV, MULT)
  • Digital Electronics (AND, OR, XOR, NAND, NOR, XNOR)
  • Prefix/Infix/Postfix Notation (+ 3 4)
  • Data Structures (heaps, binary trees, stacks, etc.)
what does this program do
What does this program do?
  • Usually written in an easy-to-understand language such as BASIC or Pascal
  • Trick is to read the code as if it were in english, and then evaluate the operations as they come.
  • program S(input, output);

var a,b:integer;

begin

a:=0;

b:=0;

for a:=0 to 5 do begin

b:=b+1;

end;

end;

      • Simple evaluation leads us to b = 6
infix notation
Infix Notation
  • Operators are written in-between operands
  • Exactly like normal mathematical evaluation
  • A * ( B + C ) / D
    • First add B to C
    • Then multiply the result by A
    • Then divide by D
prefix notation
Prefix Notation
  • Operators are written before their operands
  • Trick is to group them with parenthesis, then convert into infix notation, and evaluate
  • / * A + B C D
    • (/ (* A (+ B C) ) D )
    • Infix notation: A * (B + C) / D
postfix notation
Postfix Notation
  • Operators are written after their operands
  • Trick is to group them with parenthesis, then convert into infix notation, and evaluate
  • A B C + * D /
    • ( (A (B C +) *) D / )
    • Infix notation: A * (B + C) / D
what does this program do1
What does this program do?
  • program SR(input,output);

var a,b,c,x:integer;

begin

b:=0;

for a:=1 to 5 do begin

x:=0;

while x <= 5 do begin

c:=5;

repeat

b:=b+c;

c:=c-1;

until c=0;

x:=x+1;

end;

end

end;

What is the final value of b after SR is executed?

solution
Solution
  • 1. Read code as if it were in english
  • 2. Translate code into math
    • ( ( 5+4+3+2+1 ) * 6 ) * 5
  • 3. Evaluate mathematical operation
    • = (15) * 6 * 5
    • =15 * 30
    • = 450
prefix infix postfix notation
Prefix/Infix/Postfix Notation
  • Translate the following from prefix to postfix:
  • - + * 2 x * 3 y z
solution1
Solution
  • 1. Group problem with parenthesis
    • (- (+ (* 2 x)(* 3 y)) z)
  • 2. Translate problem into infix notation
    • (((2 * x) +(3 * y)) - z)
  • 3. Work backwards to translate from infix notation to postfix notation
    • (((2 x *)(3 y *) +) z -)
    • 2 x * 3 y * + z -
miscellaneous
Miscellaneous
  • Remember to sign in!
  • Don’t forget to turn in your check ($15, payable to Lynbrook ASB) if you haven’t done so already!
  • Remember to take the USACO (ends today)!
  • Check http://LynbrookCS.com for updates
  • Don’t forget to review the material we covered today – it comes up on the ACSL!