CP264 : Notes - Introduction
Read the Course Syllabus
Labs start in week 2. (See Labs). Take the time to follow the instructions in Lab 1: Eclipse / CDT to set up your own computer or create a workspace on your own memory stick or in your Laurier network storage before the lab.
What do we learn in Data Structures II?
In CP264: Data Structures I we learnt:
- the concepts of ADT
- array, list, stack, queue, tree, hash, graph
- the basic concepts of algorithm design and analysis with data structures
- the concepts of software engineering
- did all these in Python
In CP264 we will implement all these data structures using the C programming language.
Why we need to do data structures in C?
- C is a high level, compiled language: Source program needs to be compiled to machine code before the execution
- Python is a high level, interpreted language: Program is in form of script, Python interpreter translates each statement into a sequence of one or more subroutines already compiled into machine code, and then execute. The Python interpreter is generally written in C.
- Python's data structures are implemented in C at low level
Why C?
- We can design and implement data structures at a low memory level
- design efficient application specific data structures to meet the needs of algorithms
- C is a very popular programming language (See: Which programming languages are most popular (and what does that even mean)?
- C is capable of producing high performance programs|
- C is the programming language used to implement most of the parts of many important operating systems: Unix, Linux, Window, Android, Mac OS, QNX.
- C is the programming language for embedded systems
- Almost all processor products support C
C is used in many other courses
- CP216 Microprocessor
- CP367 Introduction to System Programming (Unix/Linux)
- CP386 Operating System
- CP411 Computer Graphics
- CP312 Algorithm & Analysis I
- CP412 Algorithm & Analysis II
CP264 and CP264 lay the foundations for all computing courses that need programming.
How Do You Do Well In The Course?
Do The Work
Practice is the only way to get familiar with this material. This is not a course in which you can memorize your way to success. You have to demonstrate you know the material by applying the material. You will have lots of opportunity to
Python vs C vs Advanced C
We will look at Python code for the array-based stack from CP264, and compare it against a simple implementation of an array-based stack in C, and against a more advanced implementation of an array-based stack in C. We will emphasize the similarties and differences in the algorithms. We do not expect you to understand must of the simple C code, and less of the advanced C code, but we will introduce basic C syntax and coding concepts.
Stack Comparisons: Python vs C vs Advanced C
(You can move the separators between the code columns to make each column wider or narrower.)
A second set of comparisons is with:
Movie Comparisons: Python vs C
We will return to these chunks of code throughout the course in order to illustrate C coding concepts and ADT design.