Introduction to Computer Science
Introduction to Computer Science CIS 252
Popular in Course
Popular in Computer & Information Science
This 9 page Class Notes was uploaded by Sam Rau on Wednesday October 21, 2015. The Class Notes belongs to CIS 252 at Syracuse University taught by Staff in Fall. Since its upload, it has received 63 views. For similar materials see /class/225604/cis-252-syracuse-university in Computer & Information Science at Syracuse University.
Reviews for Introduction to Computer Science
Report this Material
What is Karma?
Karma is the currency of StudySoup.
You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!
Date Created: 10/21/15
For a constant k Where lookup x E a Function de nition S E abstr x D Dealing With pairs S S E pair E MNpairC D Application S S E applic E N M appC D D Apply a primitive operation f Apply a closure algy D Return from function call a E return xaE 5370713 HOW TO SOLVE IT 7 G POLYA First You have to understand the problemi Second Find the connection between the data and the unknown You may be obliged to consider auxiliary problems if an immediate connection cannot be found You should obtain eventually a plan of the solution Third Carry out your plan Fourth Examine the solution obtained UNDERSTANDING THE PROBLEM What is the unknown What are the data What is the condition Is it possible to satisfy the condition Is the condition suf cient to determine the unknown Or is it insuf cient Or redundant Or contradictory Draw a gure Introduce suitable notation Separate the various parts of the condition Can you write them down DEVISING A PLAN Have you seen it before slightly different form Do you know a related problem Do you know a theorem that could be useful Look at the unknown And try to think of a familiar problem having Or have you seen the same problem in a the same or a similar unknown Here is a problem related to yours and solued before it Could you use its result Could you use its method Should you Could you use introduce some auxiliary element in order to make its use possible Could you restate the problem Could you restate it still differently Go back to de nitions If you cannot solve the proposed problem try to solve rst some related problem Could you imagine a more accessible related problem A more general problem A more special problem An analogous problem Could you solve a part of the problem Keep only a part of the condition drop the other part how far is the unknown then determined how can it vary Could you derive something useful from the data Could you think of other data appropriate to determine the unknown Could you change the known or the data or both if necessary so that the new unknown and the new data are nearer to each other Did you use all the data Did you use the whole condition Have you taken into account all essential notions involved in the problem CARRYING OUT THE PLAN Carrying out your plan of the solution check each step Can you see clearly that the step is correct Can you prove that it is correct LOOKING BACK Can you check the result Can you check the argument Can you derive the result differently Can you see it at a glance Can you use the result or the method for some other problem DECLARATIVE PROGRAMMING LANGUAGES Jim Royer EECS Department A HISTORICAL DIGRESSION gt Algebra is largely an Arabic in vention o Muhammed ibn Musa al Khwarizmi 9th century AD 0 completing the squarequot 0 solving quadratic equationsquot aar2 bar c CARDANO S RHETORICAL ALGEBRA CIRCA 1550 Solve Let a cube and six times its side equal 20 36220 A Solution Cube one third the number of sides ie the coef of x Add to it the square of one half the constant of the equation and take the square root of the whole You will put this twice and to the one of the two you add one half the number you have squared and fr0m the other you subtract one haft the same You will then have a binomium ie m10 and its apotome ie W m Then subtracting the cube root of the apo t0me fr0m the cube root of the bin0mium the remainder is the required side as 3x108 10 3 108 10 THE MODERN NOTATION gt Francois Viete 1540 1603 0 French lawyer royal counselor math ematician and cryptographer o 1592 In Artem Analyticem lsagogequot g h 39 J N l 3 J39TIL lquot I l I E ne39er 140 71701111111503 PROGRAMMING IMPERATIVE VS DECLARATIVE Ordinarily technology changes fast But programming languages are different programming languages are not just technology but what programmers think in They re half technology and half religion Paul Graham Beating the Averages Imperative programming languages gt Eg C C gt spell out computations gt tricky to manipulate Declarative programming languages gt Eg Lisp Scheme ML Haskell Python gt spell out relations ideally gt easy to manipulate gt more abstract DECLARATIVE LANGUAGES PROS AND CONS Cons gt Weak programmers do not fare well gt There is sometimes a price in performance but not always gt Some things can be tricky to express eg in Haskell Pros gt Creative programmers fare well gt Some things are easy to express that are unheard of in the imperative setting eg Lisp macros gt Programs can be very close to specifications gt There is a long successful track record in prototyping Eg Perl 6 is being developed in Haskell AN EXAMPLE The list of all primes via the Sieve of Eratosthenes A bit slow but cute primes sieve 2 where sieve XXs X sieve y y lt xs y mod X gt 0 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 211 223 227 229 233 239 241 251 257 263 269 271 277 281 283 293 307 311 313 317 331 337 347 349 353 359 367 373 379 383 389 397 401 409 419 421 431 433 439 443 449 457 461 463 467 479 487 491 499 503 509 521 523 541 547 557 563 569 571 577 587 593 599 601 607 613 617 619 631
Are you sure you want to buy this material for
You're already Subscribed!
Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'