CS1010 Programming MethodologyA beginning in problem solving in Computer ScienceAaron Tan http://www.comp.nus.edu.sg/~cs1010/
CS1010 Programming MethodologyA beginning in problem solving in Computer Science
Aaron Tan http://www.comp.nus.edu.sg/~cs1010/
2
Contents What is Computer Science (CS)? What is Problem Solving? What is Algorithmic Problem Solving? [CS1010: A beginning in problem solving in CS]
3
What is Computer Science? Computing Curricula 2001 (Computer Science) Report identifies 14 knowledge focus groups Discrete Structures (DS) Programming Fundamentals (PF) Algorithms and Complexity (AL) Architecture and Organization (AR) Operating Systems (OS) Net-Centric Computing (NC) Programming Languages (PL) Human-Computer Interaction (HC) Graphics and Visual Computing (GV) Intelligent Systems (IS) Information Management (IM) Social and Professional Issues (SP) Software Engineering (SE) Computational Science (CN) 3 [CS1010: A beginning in problem solving in CS] P = NP ? O(n2)
Computer science or computing science (sometimes abbreviated CS) is the study of the theoretical foundations of information and computation and of practical techniques for their implementation and application in computer systems. It is frequently described as the systematic study of algorithmic processes that create, describe, and transform information. The branch of engineering science that studies (with the aid of computers) computable processes and structures.
4
Problem Solving Exercises The exercises in the next few slides are of varied nature, chosen to illustrate the extent of general problem solving. Different kinds of questions require different domain knowledge and strategies. Apply your problem solving skills and creativity here! [CS1010: A beginning in problem solving in CS]
5
Warm-up #1: Glasses of milk Six glasses are in a row, the first three full of milk, the second three empty. By moving only one glass, can you arrange them so that empty and full glasses alternate? [CS1010: A beginning in problem solving in CS]
6
Warm-up #2: Bear A bear, starting from the point P, walked one mile due south. Then he changed direction and walked one mile due east. Then he turned again to the left and walked one mile due north, and arrived at the point P he started from. What was the colour of the bear? [CS1010: A beginning in problem solving in CS]
7
Warm-up #3: Mad scientist A mad scientist wishes to make a chain out of plutonium and lead pieces. There is a problem, however. If the scientist places two pieces of plutonium next to each other, KA-BOOM!!! [CS1010: A beginning in problem solving in CS] In how many ways can the scientist safely construct a chain of length 6? General case: What about length n?
Similar to Fibonacci sequence: 2, 3, 5, 8, 13, 21, …
8
Warm-up #4: Silver chain A traveller arrives at an inn and intends to stay for a week. He has no money but only a chain consisting of 7 silver rings. He uses one ring to pay for each day spent at the inn, but the innkeeper agrees to accept no more than one broken ring. [CS1010: A beginning in problem solving in CS] How should the traveller cut up the chain in order to settle accounts with the innkeeper on a daily basis?
9
Warm-up #5: Dominoes Figure 1 below shows a domino and Figure 2 shows a 44 board with two squares at opposite corners removed. How do you show that it is not possible to cover this board completely with dominoes? Figure 1. A domino. Figure 2. A 44 board with 2 corner squares removed. General case: How do you show the same for an nn board with the two squares at opposite corners removed, where n is even? Special case: How do you show the same for an nn board with the two squares at opposite corners removed, where n is odd? [CS1010: A beginning in problem solving in CS]
10
Warm-up #6: Triominoes Figure 3 below shows a triomino and Figure 4 shows a 4 4 board with a defect (hole) in one square. How do you show that the board can be covered with triominoes? General case: How do you show that a 2n 2n board (where n 1) with a hole in one square (anywhere on the board) can be covered with triominoes? Figure 3. A triomino. Figure 4. A 44 board with a hole. [CS1010: A beginning in problem solving in CS]
11
[CS1010: A beginning in problem solving in CS] Problem Solving Process (1/5) Analysis Design Implementation Testing Determine the inputs, outputs, and other components of the problem. Description should be sufficiently specific to allow you to solve the problem.
12
Problem Solving Process (2/5) Analysis Design Implementation Testing Describe the components and associated processes for solving the problem. [CS1010: A beginning in problem solving in CS]
13
Problem Solving Process (3/5) Analysis Design Implementation Testing Develop solutions for the components and use those components to produce an overall solution. [CS1010: A beginning in problem solving in CS]
14
Problem Solving Process (4/5) Analysis Design Implementation Testing Test the components individually and collectively. [CS1010: A beginning in problem solving in CS]
15
Problem Solving Process (5/5) [CS1010: A beginning in problem solving in CS] Analysis Design Implementation Testing Determine problem features Write algorithm Produce code Check for correctness and efficiency Rethink as appropriate
16
CS1010: Description and Objectives This module introduces the fundamental concepts of problem solving by computing and programming using an imperative programming language. Outcomes: Know how to solve simple algorithmic problems. Know how to write good small programs. C is merely a tool. This module is not just about C. [CS1010: A beginning in problem solving in CS]
17
CS1010: Your Friendly Lecturers [CS1010: A beginning in problem solving in CS] Mr Tan Tuck Choy, Aaron Sectional Groups: 3, 7 Office: COM1 #03-12 tantc@comp.nus.edu.sg http://www.comp.nus.edu.sg/~tantc/acad.html A/P Wynne Hsu Sectional Group: 1 Office: COM2 #03-05 whsu@comp.nus.edu.sg http://www.comp.nus.edu.sg/~whsu A/P Tan Soon Huat, Gary Sectional Group: 2 Office: COM2 #03-50 gtan@comp.nus.edu.sg http://www.comp.nus.edu.sg/~gtan A/P Lee Mong Li, Janice Sectional Group: 4 Office: COM2 #03-06 leeml@comp.nus.edu.sg http://www.comp.nus.edu.sg/~leeml A/P Roger Zimmermann Sectional Group: 5 Office: AS6 #05-05 rogerz@comp.nus.edu.sg http://www.comp.nus.edu.sg/~rogerz A/P Chan Chee Yong Sectional Group: 6 Office: COM1 #03-48 chancy@comp.nus.edu.sg http://www.comp.nus.edu.sg/~chancy A/P Tan Tiow Seng Sectional Group: 8 Office: AS6 #04-10 tants@comp.nus.edu.sg http://www.comp.nus.edu.sg/~tants Discussion leaders (DLs): Lead discussion in small discussion groups (DGs) Will be made known later. Refer to module website (Module Info – Staff)
18
CS1010: Sectional and Discussion Groups Sectional groups are small lecture groups, small enough to fit in a programming lab. Discussion groups are tutorial groups. They are even smaller, and are also conducted in programming labs. Your sectional group and discussion groups will be pre-allocated to you. All groups cover the SAME syllabus, and have common tests, and all students are graded together as a whole. [CS1010: A beginning in problem solving in CS]
19
A Peek at a Lecture Session (1/2) [CS1010: A beginning in problem solving in CS] Lecturer’s screen is broadcast to every student’s monitor. Interacting with students always makes me happy.
20
A Peek at a Lecture Session (2/2) [CS1010: A beginning in problem solving in CS] Explaining how to edit and compile a program. Discussing MasterMind.
Comments