Title Image

Announcements

  • 2021-12-07
    Please check your final exam seat number at https://course.cse.ust.hk/comp2012h/final-seating-plan.html

  • 2021-11-04
    Programming assignment 4 has been released. Submission deadline is 23:59:00 on November 20, 2021 (Saturday).

  • 2021-10-23
    Programming assignment 3 has been released. Submission deadline is 23:59:00 on November 4, 2021 (Thursday).

  • 2021-10-02
    Programming assignment 2 has been released. Submission deadline is 23:59:00 on October 19, 2021 (Tuesday).

  • 2021-9-15
    Programming assignment 1 has been released. Submission deadline is 23:59:00 on September 28, 2021 (Tuesday).

  • 2021-9-1
    The lab time in the first two weeks (i.e., September 1 & 8, 3:00 - 4:50pm) will be used to cover some COMP 2012H topics on Zoom. The meeting link can be found here.

  • 2021-9-1
    Welcome to COMP 2012H! For this course, we use our own course webpage (https://course.cse.ust.hk/comp2012h/), and grades can be found on Canvas. Also, there will be no labs in the first two weeks (September 1 & 8). The first lab starts in Week 3 (September 15).

Course Details


  • The course consists of, per week,
    • 4 hours of lectures
    • 2 hours of lab exercises
    an it gives you 5 credits for successful completion of the course.

Textbooks and Reference Books




Topics Covered

  1. Introduction to computer programming
  2. Fundamentals of C++: data types, variables, operators
  3. Flow controls
  4. Arrays
  5. Functions, scope, and recursion
  6. File I/O
  7. Pointers
  8. lvalue references
  9. Structures
  10. Class, object construction, iniitalization, and destruction
  11. Inheritance and polymorphism
  12. Generic programming
  13. Standard Template Library (STL)
  14. Static data members and member functions
  15. Some features in C++11
  16. rvalue references and move semantics
  17. Linked lists
  18. Stack and queue
  19. Binary search tree
  20. Hashing

Intended Learning Outcomes

On successful completion of this course, students are expected to be able to:

  1. Use common software tools to develop and debug a program written in an OOP language.
  2. Demonstrate that recursive and non-recursive functions are abstractions of sub-problems in a task.
  3. Describe the concept and the use of pointers in indirect addressing and dynamic memory allocation.
  4. Write object-oriented programs in C++ with object creation, destruction, member variables and functions, inheritance, polymorphisms, and templates.
  5. Analyze a program and provide simple solutions with OOP.
  6. Write basic algorithms associated with data structures such as stacks, queues, lists, trees, and hashes.
  7. Define binary tree and search tree and describe how they are used to solve problems.
  8. Develop a large program using separate compilation, good OOP design, and code reuse.

Prerequisites & Exclusions

Pre-requisite: Grade A or above in COMP 1002 (prior to 2013-14) / COMP 1021 / COMP 1022P / COMP 1022Q / ISOM 3230. Exclusion: COMP 1004 (prior to 2013-14), COMP 2011, COMP 2012.

Schedule

Lecture Schedule

Section Date and Time Room / Zoom Link Instructor
L1 Tue & Thu 09:00AM - 10:50AM Mixed-mode Lite: Rm 2405, Lift 17-18 / Zoom Meeting Link TSOI, Desmond Yau Chat

Lab Schedule

Section Date and Time Room / Zoom Link Teaching Assistant Student Helper
LA1 Wed 03:00PM - 04:50PM Zoom Meeting Link CHIU Ho Tin, PANG Hong Wing, TIAN Yao DINH, Anh Dung
LA2 This session will have no scheduled meetings. You will be provided with access to video-on-demand recordings of the weekly lab material which you will follow at your own pace.

Grading Scheme

Item Percentage
Programming assignment - PA1 8%
Programming assignment - PA2 8%
Programming assignment - PA3 8%
Programming assignment - PA4 8%
Programming project - PP 24%
Laboratory exercises 8%
Final examination 36%

Please check your own marks from the CANVAS system.

Assessment Rubrics

Course Learning Outcome

Exemplary

Competent

Needs Work

Unsatisfactory

1. Use common software tools to develop and debug a program written in an OOP language.

Use an IDE such as VS Code proficiently to write, compile, run, and debug a C++ program consisting of one or many source files.

Use an IDE such as VS Code effectively to write, compile, run, and debug a C++ program consisting of one or many source files.

Use an IDE such as VS Code to write, compile, and run a C++ program consisting of one source file. Have difficulty in dealing with programs consisting of more than one source file as well as debugging.

Have difficulty in using an IDE such as VS Code to write, compile, run, and debug a C++ program consisting of one source file without guidance.

2. Demonstrate that recursive and non-recursive functions are abstractions of sub-problems in a task.

Demonstrate thorough understanding of how recursion works. Be able to develop a recursive solution to a written problem on one's own, and sometimes contrast it with the corresponding non-recursive solution.

Demonstrate sufficient understanding of how recursion works. Be able to develop a recursive solution to a written problem if given the recursive algorithm, and sometimes contrast it with the corresponding non-recursive solution.

Demonstrate insufficient understanding of how recursion works. Be able to develop recursive solutions only to some simple problems, and only if the recursive algorithm is given. Cannot contrast the recursive solution with the corresponding non-recursive solution.

Is unable to understand how recursion works. Is unable to develop recursive solutions to problems even if the recursive algorithm is given.

3. Describe the concept and the use of pointers in indirect addressing and dynamic memory allocation.

Demonstrate strong understanding of the concept of pointers. Is able to use pointers effectively in indirect addressing and dynamic memory allocation in a great variety of scenarios.

Demonstrate sufficient understanding of the concept of pointers. Is able use pointers effectively in indirect addressing and dynamic memory allocation in standard scenarios.

Demonstrate marginal understanding of the concept of pointers. Is able to use pointers in indirect addressing and dynamic memory allocation only in simple scenarios.

Demonstrate little understanding of the concept of pointers. Have great difficulty in using pointers in indirect addressing and dynamic memory allocation even in simple scenarios.

4. Write object-oriented programs in C++ with object creation, destruction, member variables and functions, inheritance, polymorphism, and templates.

Demonstrates a comprehensive grasp of object-oriented concepts and fully demonstrates how to write object-oriented programs in C++.

Demonstrates a thorough grasp of object-oriented concepts and mostly demonstrates how to write object-oriented programs in C++.

Demonstrates a basic grasp of object-oriented concepts and barely able to demonstrate how to write object-oriented programs in C++.

Demonstrates a lack of grasp of object-oriented concepts and fail to demonstrate how to write object-oriented programs in C++.

5. Analyze a program and provide simple solutions with OOP.

Demonstrates an exemplary ability to analyze programs written in OOP.

Demonstrates a proficient ability to analyze programs written in OOP.

Demonstrates a developing ability to analyze programs written in OOP.

Demonstrates deficiencies in their ability to analyze programs written in OOP.

6. Write basic algorithms associated with data structures such as stacks, queues, lists, trees, and hashes.

Demonstrates ability to fully implement algorithms with common data structures.

Demonstrates sufficient ability to implement algorithms with common data structures.

Demonstrates preliminary understanding of how to write algorithms with common data structures.

Demonstrates a lack of understanding of how to write algorithms with common data structures.

7. Define binary tree and search tree and describe how they are used to solve problems.

Demonstrates complete understanding of binary tree / binary search tree and is able to accurately describe how they are used to solve problems.

Demonstrates sufficient understanding of binary tree / binary search tree and successfully describe how they are used to solve problems.

Demonstrates preliminary understanding of binary tree / binary search tree and barely able to describe how they are used to solve problems.

Demonstrates deficient understanding of binary tree / binary search tree and unable to describe how they are used to solve problems.

8. Develop a large program using separate compilation, good OOP design, and code reuse.

Demonstrates complete comprehension of OOP concepts and techniques for the development of large programs.

Demonstrates basic comprehension of OOP concepts and techniques for the development of large programs.

Demonstrates minimal comprehension of OOP concepts and techniques for the development of large programs.

Demonstrates no comprehension of OOP concepts and techniques for the development of large programs.

Download the pdf version here.

People

Instructor

Desmond TSOI, Desmond Yau Chat
Rm 3553
desmond@ust.hk
http://www.cse.ust.hk/~desmond
Office Hour: To be confirmed
Find me by PathAdvisor: Click Here

Teaching Assistants

Kelvin CHIU, Ho Tin
Rm 3543
kelvinchiu@cse.ust.hk
Office Hour: Lab time or by email appointment
Find me by PathAdvisor Click Here
Hong Wing PANG, Hong Wing
Rm 4223
hwpang@connect.ust.hk
Office Hour: Lab time or by email appointment
Find me by PathAdvisor Click Here
Yao   TIAN, Yao
None
ytianbc@connect.ust.hk
Office Hour: Lab time or by appointment

Lectures


The schedule listed below is tentative. Instructor may have some adjustments subject to the progress.


Part I: Structured Programming & Basic Data Structures
Week# Topics Download Reading Code / Additional Materials
1 Course Logistics Full / 4-page
1 Introduction Full / 4-page Deitel - Chapter 1
1 Fundamentals of C++ Full / 4-page Deitel - Chapter 2
1 Program Flow Control Full / 4-page Deitel - Chapter 4 & 5
2 Function Full / 4-page Deitel - Chapter 6 (except 6.12, 6.17 - 6.21)
2 Array Full / 4-page Deitel - Chapter 8.5
2 Recursion Full / 4-page Deitel - Chapter 6.18 - 6.20
3 Structure Full / 4-page Deitel - Chapter 22.2
3 Pointer Full / 4-page Deitel - Chapter 8
4 Linked List Full / 4-page Deitel - Chapter 19.3
- Separate Compilation (Function) (Self-study) Full / 4-Page Programs

Part II: Object-Oriented Programming
Week# Topics Download Reading Code / Additional Materials
5 Class and Object Full / 4-page Deitel: Chap 3 Programs
6 Constructors & Destructor Full / 4-Page Deitel: Chap 9 Programs
7 Inheritance and Polymorphism Full / 4-Page Deitel: Chap 11, 12 Programs
9 Generic Programming Full / 4-Page Deitel: Chap 18, 19, 10 Programs
10 Standard Template Library (STL) Full / 4-Page Weiss: Chap 9.14 Programs
- Static Data Members and Member Functions Full / 4-Page Weiss: Chap 9.14 Programs
- File I/O (Self-study) Full / 4-Page Deitel: Chap 14.1 - 14.4 Programs
- C++ string class (Self-study) Full / 4-Page Deitel: Chap 21 Programs
- Namespace (Self-study) Full / 4-Page Deitel: Chap 23.4 Programs
- Some New Features in C++11 Full / 4-Page Deitel: Chap 4.11.7, 7.5, 16.3, 9.6.2, 10.13 Programs
- rvalue Reference and Move Semantics Full / 4-Page Deitel: (Web) Chap 24 Programs

Part III: Advanced Data Structures
Week# Topics Download Reading Code / Additional Materials
11 Stack and Queue Full / 4-Page Weiss: Chap 3.6 - 3.7 Programs
11 - 12 Trees, Binary Trees, and Binary Search Trees Full / 4-Page Weiss: Chap 4.1 - 4.3 Programs
13 Hashing Full / 4-Page Weiss: Chap 5
- AVL Trees Full / 4-Page Weiss: Chap 4.4 Programs



Lecture Attendance via Zoom

The lecture classes this semester will be conducted in mixed-mode lite. The link for the meetings is available under the "Schedule" section of this page and at the Canvas page of the course here. Before you join a meeting for the first time, visit this page and sign in to Zoom using your HKUST e-mail, as our lecture meetings will require HKUST user authentication. When attending a lecture meeting,

  1. Please rename yourself to:

    LASTNAME Firstname studentusername E.g., CHAN Wing Ho cwingho

  2. During a Zoom meeting, please remain muted to avoid interfering the class with sounds from your background.
  3. You are highly recommended to ask question by voice. To do that, please push the Raise Hand button, and the instructor will then unmute you.
  4. You may also use the Chat function to post questions or comments. Note that if there are too many chats, the instructor may not be able to answer them timely.
  5. We strongly recommend that you turn on your camera with virtual background. It helps create a more interactive online classroom experience.
If your have not used Zoom before, we suggest that you try it out and get familiar with it before the first lecture. You can find a good general set of guidelines here.

Zoom lecture videos will be published on the supplementary website (https://www.cse.ust.hk/~desmond/comp2012h/Password_Only/) after each lecture class depending on when they become available.

Honor Code

Honesty and integrity are central to academic work. You must observe and uphold the highest standards of academic integrity and honesty in all the work (lab exercises, programming assignments, quiz, exams, etc.) you do in this course. We deal with cheating cases seriously and the maximum penalty is a FAIL in the course plus additional disciplinary actions from the CSE Department as well as from the University. Both the copier(s) and the copiee will be punished, and the penalty will be more than just a zero mark in your assignments/exams.

Here are links to the University's Honor code, and the University's Penalties for Cheating.

If you are not sure what is considered plagiarism,
  • Do NOT copy program codes from another student/person.
  • Do NOT look at the actual program codes of another student.
  • Do NOT share actual program codes with other students/people (by paper, emails, blogs, FB, Google Doc, etc.).
  • Do NOT give your program codes to other students who ask for it, and do not ask for a copy of their code either.
  • Do NOT post your program codes anywhere online.
  • Do NOT leave your finished/unfinished program codes unattended.
  • While we encourage discussion among students, you have to write codes on your own.
  • During discussion, you should NOT go to the details such that everyone will end up in the same code.
The list is by no means exhaustive, and you will need to use your own discretion.

Labs

We will use VS Code as the development platform for C++ programming. Please read the following tutorial which will help you get started:


Labs this semester will only be conducted online via Zoom meetings.

  • When attending the meeting, make sure to set up your screen username to:
    LASTNAME Firstname studentusername E.g., CHAN Wing Ho cwingho.
  • During the lab meeting, "raise hand" if you want to talk to your TA. TA will follow chronological order when handling raise hand request. If you need to share your code, you will be put in a breakout room when it is your turn.
To get point for the lab, you are requied to finish the requirement / program, and submit it to the ZINC (automatic grading system) on or before the deadline as stated on the lab page. Each lab is worth 1 point.


Note to all students:

The lab exercises are designed to help you learn a (new) programming language with on-the-spot advices of a teaching assistant. All the TAs assigned to the course are very experienced in C++ programming. It is more a service to you than an exercise for the marks. The 8% mark is only set to encourage you to make good use of the lab time. Although we don't expect you to finish the lab exercise before you attend the lab, we expect you to have read the lab's materials and understand what you are required to do.


[Public holiday exception]
If a day is a public holiday, students are not required to attend the labs held on that day. There will be no points for these labs for only those students who originally are supposed to attend these labs; other students are not affected. As different students may be affected by different public holidays, the final total lab points will be normalized according to the number of labs a student has to take. However, although a student may not need to attend a lab on a day that happens to be a public holiday, we strongly encourage the student to still go over the materials of that lab and try to finish it. Labs help students review what they are taught in lectures and get ready for the next lab.

This policy will also apply to situations when classes/labs are cancelled due to, e.g., adverse weather conditions, etc.


Exam

Final Exam

  • Date: 8 December 2021 (Wednesday)
  • Time: 12:30pm - 3:30pm
  • Venue: Tsang Shiu Tim Art Hall
  • Scope:
    • Introduction
    • Fundamentals of C++
    • Program Flow Control
    • Function
    • Array
    • Recursion
    • Structure
    • Pointer
    • Linked List
    • Class and Object
    • Constructors and Destructor
    • Inhertiance and Polymorphism
    • Generic Programming
    • Standarad Template Library
    • Stack and Queue
    • Trees, Binary Trees, Binary Search Trees
    • Hashing
    • C++ string Class
  • Note: Static Data Members and Member Functions, AVL Trees, New Features in C++11, rvalue Reference and Move Semantics, File I/O and Namespace WILL NOT BE COVERED.
  • All materials, including lecture notes, lab exercises, PAs, textbook, and any additional learning materials we posted on the course website, may be tested.

  • Statistics:
    • Mean: 65.87
    • Stdev: 16.40
    • Median: 70.86
    • Max: 91.75
    • Score distribution:
  • Exam Papers, Solutions and Marking Scheme: Here

Exam Papers of the Past Years

COMP 2011 COMP 2012
Mid-Term Exams Final Exams Mid-Term Exams Final Exams
2018F Not Available Not Available 2018F Question I | Question II | Solution Question I | Question II | Solution
2018S No Midterm Question | Solution 2018S Question | Solution Question | Solution
2017F Question | Solution Question | Solution 2017F Question | Solution Question | Solution
2017S Question | Solution Question | Solution 2017S Question | Solution Question | Solution
COMP 2012H
Mid-Term Exams Final Exams
2020F No Midterm Exam Question | Solution
2019F Question | Solution No Final Exam
2018F Question I | Question II | Solution Question I | Question II | Solution

FAQs

How hard should I work?


Some people say that a 3-unit course takes 8 hours/week. It all depends. You should cultivate an independent learning habit.

Here is a guideline:
  • pre-study (15 - 30 minutes): what topic/materials will the coming lecture be covering?
  • attend class: The A+ students tell you that they pay FULL attention in class and try to understand everything in the class so that it is easy to review the class materials.
    • our notes provide a guideline; also take your own notes
    • ask questions whenever you don't understand
  • post-study (3 hours): re-reading the notes, book reading

How do I learn a new programming language?


Learning a programming language is similar to learning a human language (like Chinese, English, French, etc.) but only easier. However, the basic technique is similar to the 3Rs:
  • read more: we are not going to follow the recommended textbook vigorously, and we can't give all the details in our lectures. Read the book!
  • write more: there are only 3 programming assignments in this class. That is NOT enough! Think of problems around you and try to solve them by writing a computer program.

 

How can I write a program effectively?


You should spend a lot of time in THINKING (stay away from the computer) before you start WRITING. No matter how beautiful your codes are, if the method you use is wrong, they are still wrong codes.

Here is a guideline:
  • planning (30 - 40%) : algorithm design, code design, documentation
  • coding (60 - 70%) : writing code, debugging, testing

What operating system do I use to program for this class?


The labs will be conducted using the Windows operating system. However, we will be using the VS Code programming environment with the GCC compiler. This is a multi-platform solution that you can set up on your PC, Mac, and Linux. For information on setting up VS Code, please refer to this page.

 

Where may I get help on programming problems?


God help those who help themselves! But if you can't find your God, try the following, in that order:
  • Email your question to your TAs. (We do most business using emails here in the university.) Please do not expect an answer right away.
  • Email your question to the instructor.
  • Don't expect the instructors and your TAs to be your debugger! Except for obvious bugs, we won't debug for you.
  • Find it on the Web.

Where may I get more information about the computing facilities in CSE department?


You can't afford to miss the following URL from our cssystem:
http://cssystem.cse.ust.hk/home.php?docbase=UGuides&req_url=UGuides/index.html#ug