1 / 9

computer science

CSCI 1001. overview of. computer science. ALGORITHMS. Algorithm. “A well-ordered collection of unambiguous and effectively computable operations that, when executed, produces a result and halts in a finite amount of time.”. How do we describe an algorithm?. PSEUDOCODE.

makoto
Télécharger la présentation

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. CSCI 1001 overview of computer science ALGORITHMS

  2. Algorithm “A well-ordered collection of unambiguous and effectively computable operations that, when executed, produces a result and halts in a finite amount of time.” How do we describe an algorithm?

  3. PSEUDOCODE Sequential operations “Set variable = expression” “get variable” “input: variable” “print variable” • “output variable” Conditional operations if boolean expression then operation sequence else alternate operation sequence

  4. PSEUDOCODE Iterative operations while boolean expression sequence of operations for each variable in list of values sequence of operations

  5. Finding common friends input: list of names, alice1…alicek input: list of names, bob1…bobm • go through both lists and if you find a • name in common, print it out.

  6. Finding common friends input: list of names, alice1…alicek input: list of names, bob1…bobm set i = 0 set j = 0 while i < k while j < m if alicei = bobj then print alicei set j to j+1 set k to k+1

  7. ( ) xkcd. com

  8. FLOWCHARTS Sequential operation Conditional True False

  9. http://cs1001.us/ Please read Sections 1 and 2 of the Python chapter for Monday

More Related