1 / 33

Two-week ISTE workshop on Effective teaching/learning of computer programming

Dr Deepak B Phatak Subrao Nilekani Chair Professor Department of CSE, Kanwal Rekhi Building IIT Bombay Lectures 13, Examples, CS101 group projects at IITB Tuesday 6 July 2010. Two-week ISTE workshop on Effective teaching/learning of computer programming. Overview.

osborn
Télécharger la présentation

Two-week ISTE workshop on Effective teaching/learning of computer programming

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. Dr Deepak B Phatak Subrao Nilekani Chair Professor Department of CSE, Kanwal Rekhi Building IIT Bombay Lectures 13, Examples, CS101 group projects at IITB Tuesday 6 July 2010 Two-week ISTE workshop onEffective teaching/learning of computer programming

  2. Overview • The load balancing problem • Course projects in CS 101 at IIT Bombay

  3. Problem of balancing load in two trucks • There are two trucks, each of which contains packages having different weights. We make an assumption that all weights are integers (e.g. 85 Kg, 23 Kg, 7 Kg, etc.). • We wish to balance the load in both the trucks and wish to find out if it is possible to swap exactly one pair of packages between two trucks to achieve this.

  4. Initial thoughts on program design How should we represent the problem data? Since we will be required to compare weights of packages from each truck with those in the other, the best way would be to read the respective load values in two arrays Assuming max no of packages in each truck to be 100, We will use integer arrays A and B of size 100, each will have M and N elements respectively.

  5. What should our program find? There may exist pairs of elements of the type (x, y) such that; x is an element of A and y is an element of B, and if these are swapped across the arrays, then the resultant arrays will have the property that sum of elements in new array A = sum of elements in new array B One possible algorithm is to iterate on one array B, and for each element of B, which represents a weight y, find the permissible value of x (how?); and then find if A has an element whose value is x

  6. Program for load balancing #include<iostream> #include<math.h> using namespace std; int main(){ int A[100], B[100], M, N, i, j, sum1, sum2, diff, x, y; // Read numbers in two arrays cin >> M; for (i=0; i<M; i++) cin >> A[i]; cin >> N; for (i=0; i<M; i++) cin >> B[i];

  7. Program for load balancing … // Find sum of all elements of each array sum1 = 0; for (i=0; i<M; i++) sum1 += A[i]; sum2 = 0; for (i=0; i<N; i++) sum2 += B[i]; diff = abs (sum1 - sum2); if (diff%2 !=0) { cout << “Difference of sums is not even”; cout << “Desired elements do not exist”; cout << endl; return 1; }

  8. Program for load balancing … // Now locate the elements meeting the criterion// if x is element of A, and y element of B, // we need to find x and y such that // sum1 +y = sum2 + x// or x = sum1 - sum2 + y // // In general, for some j, // if we are looking at B[j] // then for some I, we must have // A[i] = sum1 –sum2 + B[j]

  9. Program for load balancing … for (j=0; j < N; j++){ // start with some B[j] // Find desired value x x = sum1 - sum2 + B[j]; // search for x in array Afor (i=0; i < M; i++){ if (A[i] == x){ cout >> A[i] >> ? ? >> B[j]; } else{ break; // abandon search, } } }

  10. Analysis of algorithm If M = N, the problem “size” is N In our program, We have an outer iteration executing N times - every time considering one value from B[] For each outer iteration, - we have an inner iteration also executing N times checking every value in A[] So the complexity of this algorithm is O(N2) - If we search A using binary search, the inner iteration will execute only Log2N times Complexity will be O(N log2N)

  11. An important Note • Some of us are confusing between the complexity of an algorithm with the time required to execute a specific program, [as seen from the ‘time’ command] • THESE TWO ARE COMPLETELY DIFFERENT THINGS. • Thus, there is no notion of reducing ‘complexity’ by, say, 6 seconds • Complexity is ONLY expressed as O(f(N)) [and NEVER as minute or seconds], representing the behaviour of an algorithm as its ‘size’ N becomes very large (tends to infinity)

  12. CS 101 project activities at IIT Bombay • The class was divided into 40 batches • Each batch had ~ 20 students • Divided into 5 teams • A batch was required to do a single project involving the following Tasks: Task 1 (25%) Programming project Task 2 (10 Marks). Preparation of Quiz and exam questions, along with answers

  13. Programming Projects • Open ended Projects • What is to be done is not well defined • Team work will mean skewed efforts • But the learning here will be unique and important • Learn to take decisions • Learn to discuss, design, document • Spend time on deciding • Naming conventions • File structure , Memory data structures • Identify functions, write stubs

  14. Project Groups • There were ten groups: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 • Each group will together work on 4 projects R, C, D, A • Group will have 4 lab batches: • Each lab batch will work independently on one project • The four lab-batch coordinators together will be responsible for taking decisions on basic data/file design and for common interface definitions

  15. Course Projects • The coordinator for a batch, in consultation with other team leaders, will allocate each of the five ‘activities’ under the project to a team. • Within the team, the team leader will allocate work to individual members. Since the work involves not just programming, but also testing, documentation, data and file management, schedules and meetings, reporting, etc., there is considerable flexibility in the allocation of work

  16. Course Projects ... • Minimally, every student should write at least one program/function for his/her team, and additionally should carry out at least one common task for the batch/team • Each student must maintain a record of the time spent for the project and specific work done in that time. The categorization of nature of the work could be as shown in the next slide

  17. Course projects ... • Discussions (names of participants, nature of discussion, decisions taken) • Design: Data/file/algorithm/function/program • Programming • Testing/Documentation/Report writing • Logistics (maintaining manual records of fingerprints collected, uploading files, CVS work) • Miscellaneous

  18. Course Projects ... • Each student must submit the diary entries in the form of a common electronic document on a weekly basis. • The format is to be decided by the group. A simple text format, which can be edited using g-edit is recommended. • Each lab-batch will count the weekly total of person hours spent by each team of the lab-batch, and by the batch as a whole on the project • All individual diary entries for the week, in the form of a single consolidated document is to be submitted to batch JTA (also upload on Moodle)

  19. Submissions • All submissions are due midnight of each Sunday. This is a hard deadline. The submission need not be perfect, it needs to be complete and in time • Suggestion: Do not wait for the last minute, target your submission by Saturday midnight • Each weekly submission will be include • Consolidated diary-document for the week • Any design/documentation/partial program code/testing/report prepared • All files/directories should be put together in a single tar, and uploaded on the batch Moodle

  20. Submissions and evaluation • Project evaluation • 15 Marks for The lab-batch • Each student gets the same marks • Will be evaluated jointly by the batch JTA and te group’s Senior TA • 10 Marks for each student based on peer review

  21. Peer review • Perhaps never attempted by any of you earlier • Good time to learn • Award Marks out of 10 • Based on the quantitative and qualitative contribution by each student • Initial inputs from the team leaders • Scrutiny by the coordination committee of all team leaders from a batch • Finalization in a group meeting where every student defends himself/herself

  22. Peer review • I may choose any two students from a batch and conduct a rigorous viva • Examine their diaries in detail asking questions to corroborate the details • Ask questions on the specific work they claim to have done • Arrive at my own judgment of marks out of 10 • If the marks awarded through peer review are significantly higher, then the difference between my marks and those given through peer review will be deducted from the marks of each student of the batch

  23. Sample questions • TEST QUESTIONS : (Batch 1D) QUESTION 1 : Difficulty : Simple Armstrong number is a number wherein the sum of the cubes of its digits is equal to the number itself. Format, abc = a^3 + b^3 + c^3 For e.g, (a) 153 = 1^3 + 5^3 + 3^3 Using the above information, write a program to find all Armstrong numbers between 1 and a given number "n" inputted from the user.

  24. Sample questions … Student1 > #include<iostream> using namespace std; int main() { int i,n,d,j,sum,flag=0; cout<<"Enter the number upto which armstrong number are to be found"<<endl; cin>> n; cout<< endl<<"The result for Armstrong numbers is : "<<endl;

  25. Sample questions … for (i=1;i<=n;i++) { j=i; sum=0; while( j != 0) { d= j%10 ; sum = sum + (d*d*d); j= j/10; }

  26. Sample questions ... if (sum==i) { cout<< i<<endl; flag=1; } } if (flag==0) {cout<< "No Armstrong numbers in this range"<<endl;} return (0); }

  27. Sample Questions ... Student2 > #include<iostream> using namespace std; int main() ------------- Student3> ------------- FINAL SOLUTION QUESTION 1 : (student1) /* Program to find all Armstrong Numbers between 1 and 'n' (entered) */ ------------

  28. Sample questions ... • Each lab batch had five teams • Each team prepared one question • Total 3 test questions and 2 quiz questions of differing complexity • 3 students from each team wrote sample answers, the other 2 selected the final model answer, modified it and submitted

  29. Sample project documentation • Included in files uploaded on workshop moodle

  30. Peer Evaluation TEAM 1 ROLL NO. NAME MARKS 09010081 Yogesh Kove 09 coding, task , allotment ,discussion 09103002 Prashi Badkur 09 test files and code documentation,discussion 09103011 Trushna Khivasara 09 test files and code documentation, hepled in coding,discussion 09026011 Abhijeet Alase 10 "main code developer",discussion,basic algorithm

  31. Peer Evaluation … team 4 - 09528001- Sumit Singh 08 - discussed and make basic algo. and use of "eof“ 09011011- Radhika Goel 06 - use of "ctime" 09509021- Soumitra Bag 07 - basic code to read a file 09103021- Raunak 10 total code and finalise it. ("best work in team 4")

  32. Proposal for next offering of CS101 • Continue with the same approach • Increase the weightage of peer evaluation marks from 10% to 20% • Last time the class average was 7.3

  33. THANK YOU

More Related