Week 01 (Monday)
COMP1921 16s2 Computing 1B | 1/42 |
Ashesh Mahidadia
Web Site: http://www.cse.unsw.edu.au/~cs1921/16s2/
COMP1921 16s2 Course Convenor | 2/42 |
Ashesh Mahidadia | ||
ashesh@cse.unsw.edu.au | ||
Artificial Intelligence, Machine Learning, Knowledge based Systems |
COMP1921 16s2 Tutorials and Labs | 3/42 |
Mei Cheng Whale | ||
9385 5683 | ||
meicheng@cse.unsw.edu.au | ||
Course Aims | 4/42 |
This course aims to extend your programming knowledge
Access to Course Material | 5/42 |
All course information is placed on the course website:
Slides/Tutorials/Labs are publically readable.
If you need to post/submit/etc, you need to login.
Inputs | 6/42 |
At the start of this course you should be able to:
if
for
while
Exercise: C revision | 7/42 |
On a piece of paper, write a C program that:
#include
Outputs | 8/42 |
At the end of this course you should be able to:
Schedule | 9/42 |
Lectures Ch Notes Intro, C revision, C execution model 1-6 First tute/lab Single-, multi-dimensional arrays & pointers 7 - Testing, debugging, performance - - Structured data types 8 Quiz 1 Dynamic memory allocation 10 - Linked lists 10 Assignment released Stacks and queues 10 - Abstract data types 10 Quiz 2 Binary trees 10 - Random numbers, File operations 11 - Sorting algorithms 12 - Problem solving strategies 9 Final tute/lab, Assignment due
Credits for Material | 10/42 |
Always give credit when you use someone else's work.
Ideas for the COMP1921 material are drawn from
Resources | 11/42 |
Textbook:
Lectures | 12/42 |
Lectures will:
Lecture slides will be made available before lecture.
Feel free to ask questions, but No Idle Chatting.
Tutorials | 13/42 |
Tutorials aim to:
Tutorials start this week (Week 2)
Tutorial and lab exercises available on web Thursday the week before
... Tutorials | 14/42 |
To get the best out of tutorials
To get the most from tutorials ... participate
Lab Classes | 15/42 |
Each tutorial is followed by a two-hour lab class.
Lab exercises aim to build skills that will help you to
Each lab exercise is a small implementation/analysis task.
Do them yourself! and Don't fall behind!
... Lab Classes | 16/42 |
Lab exercises contribute 10% to overall mark.
In order to get a mark, lab exercise for Week X must be
You can work in teams of two for the lab exercises
Quizzes | 17/42 |
There are 2 'mid-session' quizzes: one each in weeks 5 and 9.
Assignment | 18/42 |
The assignment gives you experience applying tools/techniques
(but to a larger programming problem than the lab exercises)
The assignment will be carried out individually.
The assignment is due at 11:59pm, Friday, Week 13.
15% penalty will be applied to the maximum mark for every 24 hours late after the deadline.
The assignment contributes 15% to overall mark.
... Assignment | 19/42 |
Advice on doing the assignments:
They always take longer than you expect.
Don't leave them to the last minute.
Organising your time → no late penalty.
If you do leave them to the last minute:
Plagiarism | 20/42 |
You attempt Labs and Assignments unsupervised ...
Plagiarism = submitting someone else's work as your own.
We get very annoyed by people who plagiarise.
Plagiarism will be checked for and punished.
You must be able to demonstrate and explain programs to your tutor.
It's not clever to try to get through this course by copying.
Most of you will be doing more computing in your own schools.
... Plagiarism | 21/42 |
We frown on plagiarism BUT ...
In some places, we will allow it
Final Exam | 22/42 |
3-hour on-line exam during the exam period.
Held in CSE labs (must know lab environment)
Some on-line documentation will be available.
Format:
... Final Exam | 23/42 |
How to pass the Exam:
Supplementary Exams | 24/42 |
You can apply formally for special consideration
Assessment Summary | 25/42 |
labs = mark for labs (out of 10) quiz1 = mark for quiz 1 (out of 5) quiz2 = mark for quiz 2 (out of 15) ass = mark for assignment (out of 15) exam_w = mark for written part of final exam (out of 20) exam_c = mark for coding part of final exam (out of 35) mark = labs + quiz1 + quiz2 + ass + exam_w + exam_c
To pass the course, you must achieve:
[exam_c + quiz1 + quiz2]
How to Pass this Course | 26/42 |
Programming is a skill that improves with practice.
The more you practise, the easier will be labs/quizzes/assignment/exam.
Don't restrict practice to lab times and two days before assignment due.
It also helps to pay attention in lectures and tutorials.
Summary | 27/42 |
The goal is for you to become a better programmer
Exercise: Integers between N and M | 28/42 |
Consider the program to print the first 10 integers.
Modify it so that can ...
Use sscanf()
int n; sscanf(argv[1], "%d", &n);
C Language/Style |
COMP1921 Style | 30/42 |
Extends the range of allowed constructs:
if
switch
while
for
break
continue
... COMP1921 Style | 31/42 |
Good: gives you more freedom and power
Bad: gives you more freedom and power
Sidetrack: Obfuscated Code | 32/42 |
C has a reputation for allowing obscure code, leading to ...
The International Obfuscated C Code Contest
www.ioccc.org
... Sidetrack: Obfuscated Code | 33/42 |
Most artistic code (Eric Marshall, 1986)
extern int errno ;char grrr ;main( r, argv, argc ) int argc , r ; char *argv[];{int P( ); #define x int i, j,cc[4];printf(" choo choo\n" ) ; x ;if (P( ! i ) | cc[ ! j ] & P(j )>2 ? j : i ){* argv[i++ +!-i] ; for (i= 0;; i++ ); _exit(argv[argc- 2 / cc[1*argc]|-1<4 ] ) ;printf("%d",P(""));}} P ( a ) char a ; { a ; while( a > " B " /* - by E ricM arsh all- */); }
... Sidetrack: Obfuscated Code | 34/42 |
Just plain obscure (Ed Lycklama, 1985)
#define o define #o ___o write #o ooo (unsigned) #o o_o_ 1 #o _o_ char #o _oo goto #o _oo_ read #o o_o for #o o_ main #o o__ if #o oo_ 0 #o _o(_,__,___)(void)___o(_,__,ooo(___)) #o __o (o_o_<<((o_o_<<(o_o_<<o_o_))+(o_o_<<o_o_)))+(o_o_<<(o_o_<<(o_o_<<o_o_))) o_(){_o_ _=oo_,__,___,____[__o];_oo ______;_____:___=__o-o_o_; _______: _o(o_o_,____,__=(_-o_o_<___?_-o_o_:___));o_o(;__;_o(o_o_,"\b",o_o_),__--); _o(o_o_," ",o_o_);o__(--___)_oo _______;_o(o_o_,"\n",o_o_);______:o__(_=_oo_( oo_,____,__o))_oo _____;}
Switch-statements | 35/42 |
switch
if (var == Constant1) { some statements1; } else if (var == Constant2) { some statements2; } ... else if (var == Constantn) { some statementsn; } else { some statementsn+1; }
... Switch-statements | 36/42 |
Multi-way if
switch (var) { case Constant1: some statements1; break; case Constant2: some statements2; break; ... case Constantn: some statementsn; break; default: some statementsn+1; }
Note break
Exercise: If / Switch | 37/42 |
Convert the following if
switch
if (n == 1) { printf("One\n"); } else if (n == 2) { printf("Two\n"); } else if (n == 3) { printf("Three\n"); } else if (n >= 4 && n <= 9) { printf("Real Big\n"); } else { printf("Huh?\n"); }
Exercise: Count lines in stdin | 38/42 |
Write a program that
'\n'
Programming Tools |
Programming Tools | 40/42 |
Documentation (man
info
vim
emacs
kate
gcc
javac
g++
... Programming Tools | 41/42 |
Version control (cvs
svn
make
ant
eclipse
... Programming Tools | 42/42 |
Debuggers (gdb
ddd
lldb
gprof
Produced: 11 Aug 2016