Problem Solving with Algorithms and Data Structures Bruce Tsai
Computer Science • Algorithm • Step-by-step procedure for calculations • Data structure • Way of organizing data
Problem-solving • Human • Time consuming • Computer • Efficiency • Reuse • Communication tool • Program • Method and Data • Mathematical model • Input/Output
Sorting Example 50, 19, 1, 120, 6, 5, 999 1, 5, 6, 19, 50, 120, 999
Python Data Type • int • float • bool • weak type • dynamic strongly type
Python Collection • List [] • ordered • duplicate elements • mutable • compound data • Tuple () • ordered • duplicate elements • immutable • heterogeneous data
Python Collection • Set {}, set() • unordered • no duplicate elements • mutable • heterogeneous data • Dictionary { key: value} • key-value pair • no duplicate keys • mutable • heterogeneous data
Python String • “” or ‘’ • ordered • duplicate elements • immutable • homogeneous
Python Control Structure • while • execute code repeatedly based on given condition • for • allow code to repeatedly executed • if, elif, else • perform different computations depending on condition
Exception • Syntax error • Logical error (runtime error) • Exception • prevent program to terminate from runtime error
Function • Mathematical function • Black box • Input/Output
Reference • http://interactivepython.org/runestone/static/ pythonds/index.html • https://docs.python.org/2/tutorial/ • http://zeroturnaround.com/rebellabs/there-is-more-to- code-quality-than-just-pretty-vs-ugly/

Problem Solving with Algorithms and Data Structures

  • 1.
    Problem Solving with Algorithms and Data Structures Bruce Tsai
  • 2.
    Computer Science •Algorithm • Step-by-step procedure for calculations • Data structure • Way of organizing data
  • 3.
    Problem-solving • Human • Time consuming • Computer • Efficiency • Reuse • Communication tool • Program • Method and Data • Mathematical model • Input/Output
  • 4.
    Sorting Example 50,19, 1, 120, 6, 5, 999 1, 5, 6, 19, 50, 120, 999
  • 5.
    Python Data Type • int • float • bool • weak type • dynamic strongly type
  • 6.
    Python Collection •List [] • ordered • duplicate elements • mutable • compound data • Tuple () • ordered • duplicate elements • immutable • heterogeneous data
  • 7.
    Python Collection •Set {}, set() • unordered • no duplicate elements • mutable • heterogeneous data • Dictionary { key: value} • key-value pair • no duplicate keys • mutable • heterogeneous data
  • 8.
    Python String •“” or ‘’ • ordered • duplicate elements • immutable • homogeneous
  • 9.
    Python Control Structure • while • execute code repeatedly based on given condition • for • allow code to repeatedly executed • if, elif, else • perform different computations depending on condition
  • 10.
    Exception • Syntaxerror • Logical error (runtime error) • Exception • prevent program to terminate from runtime error
  • 11.
    Function • Mathematicalfunction • Black box • Input/Output
  • 12.
    Reference • http://interactivepython.org/runestone/static/ pythonds/index.html • https://docs.python.org/2/tutorial/ • http://zeroturnaround.com/rebellabs/there-is-more-to- code-quality-than-just-pretty-vs-ugly/