1 / 35

CMSC 150 Introduction TO Computing

CMSC 150 Introduction TO Computing. CS 150: Mon 9 Jan 2012. About Me. Dr. Lewis Barnett Office: 212A Jepson Hall Office Hours: Most anytime, but especially MT 2:30 - 3:30 pm; WR 10:30 - 11:30 am; lbarnett@richmond.edu http:// www.mathcs.richmond.edu/ ~lbarnett /.

glynn
Download Presentation

CMSC 150 Introduction TO Computing

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. CMSC 150IntroductionTOComputing CS 150: Mon 9 Jan 2012

  2. About Me • Dr. Lewis Barnett • Office: 212A Jepson Hall • Office Hours: Most anytime, but especially MT 2:30 - 3:30 pm; WR 10:30 - 11:30 am; • lbarnett@richmond.edu • http://www.mathcs.richmond.edu/~lbarnett/

  3. First: Meet Doug

  4. He Decides Network Connections

  5. Connections Doug Can Choose

  6. Hours to Install Each Connection 5 4 2 5 3 1 1 3 9 2 2 2 6 3 4 4

  7. What Doug Wants… • A set of connections so that: • a connection to each place (no place left out) • no loops • sum of all installation times is minimum 2 2 2 2 2 2 3 3 3 4 4 4 three loops here one loop here no loops here

  8. Start With A Smaller Example • Which connections should you include? 2 1 4 2 5 3 5

  9. Start With A Smaller Example • Which connections should you include? • Likely the shorter ones… 2 1 4 2 5 3 5

  10. Start With A Smaller Example • Which connections should you include? • Likely the shorter ones • Less likely the longer ones… 2 1 4 2 5 3 5

  11. Step by Step… 2 1 4 2 5 3 5 2 1 4 2 5 3 5

  12. Step by Step… 2 1 4 2 5 3 5 2 1 1 4 2 5 3 5

  13. Step by Step… 2 1 4 2 5 3 5 2 2 1 1 4 2 5 3 5

  14. Step by Step… 2 1 4 2 5 3 5 2 2 1 1 4 2 2 5 3 5

  15. Step by Step… 2 1 4 2 5 3 5 2 2 1 1 4 2 2 5 3 3 5

  16. Step by Step… 2 1 4 2 5 3 5 2 2 1 1 4 2 2 5 3 3 5 loop!

  17. Step by Step… 2 1 4 2 5 3 5 2 2 1 1 4 2 2 5 3 5 5

  18. Step by Step… 2 1 4 2 5 3 5 2 2 1 1 − each place connected − no loops − sum of times is minimum 4 2 2 5 3 5 5

  19. Minimal vs. Not 2 1 − each place connected − no loops − sum of times is minimum 4 2 5 3 5 2 1 − each place connected − no loops − sum of times is NOT minimum 4 2 5 3 5

  20. You Try It… 5 4 2 5 3 1 9 3 2 1 2 2 6 3 4 4

  21. Was This Your Result ? − each place is connected − no loops − sum of times is minimum: 28 hours 5 4 2 5 3 1 9 3 2 1 2 2 6 3 4 4

  22. Doug is a Happy Fellow! 5 4 2 5 1 1 3 2 2 3

  23. Your Next Task • Break into pairs… • Write down the procedure you used: • think in general terms • how do you start? • how do you proceed from there? • when do you finish?

  24. Your Algorithm Include path with min time (ties broken arbitrarily) Include next shortest path if it does not introduce a loop Repeat step 2 until each place has a path connected to it • You have just written down your first algorithm • Kruskal’s algorithm for finding Minimum Spanning Tree

  25. Algorithms • Algorithm: Set of instructions for solving a problem • known starting condition • well-defined sequence of steps • terminates • Computation: applying an algorithm to an input to obtain an output (solution) • Key: different algorithms can solve same problem • Choose the “best” algorithm

  26. Applications of MST • Network Design • computer, electrical, cable, road, … • e.g., want set of lines that connects all offices with minimum total cost • Real-time face verification • Particle interactions in fluid flows • Ethernet bridging to avoid cycles in network

  27. About This Course • An introduction to the science of computing • You will learn: • how to think algorithmically • how to write your solutions in a program (in Java) • how to debug and testyour solutions

  28. Remember… • Computer science is not (just) programming • Computer scientists do much more than program • They develop algorithms to solve problems • using the computer (and programs) • incorporating a variety of disciplines • myriad applications and real-world benefits…

  29. Google’s Autonomous Vehicle

  30. But We Have To Start Simple… Java Program (Source) Compiler Java Program (Byte Code) You write the source code in an IDE, e.g., BlueJ

  31. But We Have To Start Simple… Java Program (Source) Compiler Java Program (Byte Code) The compiler is a program that converts source to binary; Included in BlueJ

  32. But We Have To Start Simple… Java Program (Source) Compiler Java Program (Byte Code) Byte code version can be executed on computer

  33. Let’s Write Our First Program !

More Related