Course Introduction CS 1037 Fundamentals of Computer Science II

  • View
    229

  • Download
    4

Embed Size (px)

Citation preview

  • Slide 1
  • Course Introduction CS 1037 Fundamentals of Computer Science II
  • Slide 2
  • Course Info Subject: C++, data structures, algorithms Marks: 20% assignments + 5% weekly labs 30% midterm + 45% final People: Andrew, Mohsin, Ganesh, Da, Anthony, Jenny Assignments, labs, announcements http://www.csd.uwo.ca/courses/CS1037a/ 2
  • Slide 3
  • You Should Already Know Variables, built-in types Arrays (just the basics) Functions, if-else, loops 3 int num_students = 68; int grades[68]; grades[7] = -100; // die cheater die int average_grade() { int sum = 0; for (int i = 0; i < num_students; ++i) sum += grades[i]; return sum / num_students; }
  • Slide 4
  • You'll Learn Lots More C++ Pointers & References Templates Classes int max(int a, int b) { // works only for int if (a < b) return b; else return a; } 4 int* b = &a; // b points to a int& c = a; // c refers to a class circle { point center; int radius; void draw(); }; template T max(T a, T b) { // works for any type (int, float, char) if (a < b) return b; else return a; }
  • Slide 5
  • You'll Learn Data Structures Dynamic Arrays Linked Lists Stacks, Queues Trees 5 dynarray grades(num_students); grades[7] = -100; // die cheater die linkedlist courses; courses.push_front(1037); queue keys; keys.push_back('A'); binarytree presidents; presidents.insert("Obama");
  • Slide 6
  • You'll Learn Algorithms Sorting Searching Asymptotic Analysis (what do you mean by fast?) 6 int prices[4] = { 8, 15, 1, 10 }; sort(prices, prices+4); // prices = { 1, 8, 10, 15 } int pos = binary_search(prices, prices+4, 10); // pos = 2 O(1) O(log n) O(n) O(n 2 ) O(2 n ) means fast means slow n time # items
  • Slide 7
  • variables if-else loops arrays pointers functions CS1036 Programming Skills Take Time! 7 effectiveness of you stuff in your brain structs classes templates sorting lists/queues trees CS1037 graphs hashing more CS2210 SE2205
  • Slide 8
  • Big Universe of Ideas! 8 variables loops if-else arrays pointers functions exceptions structs classes templates sorting lists queues trees big-O recursion polymorphism inheritance debugging assertions iterators threads networking security optimization encapsulation searching hashing clustering heaps balanced trees caching randomized algorithms graphs matching NP-completeness computability theory finite automata approximation algorithms multisets dynamic programming compression float arithmetic symbolic computation GPUs distributed computing compilers operating systems greedy algorithms interpreters parsing databases dictionaries stacks user interfaces Java Python virtual machines C# backtracking profiling reducibility C data mining assembly file I/O proof techniques portability linear algebra rasterization references physics simulation version control concurrency combinatorics UML
  • Slide 9
  • Language Popularity in 2010 9 source: http://www.langpop.com/http://www.langpop.com/
  • Slide 10
  • Bjarne Stroustrup on C++ 10 Within C++, there is a much smaller and cleaner language struggling to get out. And no, that smaller and cleaner language is not Java or C#. a fan Stroustrup started designing C++ in 1979, and is still working on it!
  • Slide 11
  • Goals of CS 1037 Understand how to use data structures implement data structures characterize an algorithms performance express computation in C++ Develop intuition about best data structure / algorithm for situation good code, poor code, and dangerous code Programming experience, confidence 11
  • Slide 12
  • Programmer Test Q: What does this statement do? Question was strong predictor of success on 1988 Advanced Placement exam... 12 "unusual patterns that emerged from a statistical analysis of the 1988 Advanced Placement Exam in Computer Science Stuart Reges, University of Washington b = b == false;