0% found this document useful (0 votes)
179 views

CS240 05 06 14

This document provides information about CS240 - Data Structures and Data Management course offered at the University of Waterloo. It discusses the course instructors, lecture times, tutorials, assignments and exams. Key aspects of the course include analyzing algorithms using asymptotic analysis, implementing abstract data types efficiently using various data structures like trees, hashing and heaps. The goal is to study methods for storing, accessing and performing operations on large data collections efficiently.

Uploaded by

ßryan Lou
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
179 views

CS240 05 06 14

This document provides information about CS240 - Data Structures and Data Management course offered at the University of Waterloo. It discusses the course instructors, lecture times, tutorials, assignments and exams. Key aspects of the course include analyzing algorithms using asymptotic analysis, implementing abstract data types efficiently using various data structures like trees, hashing and heaps. The goal is to study methods for storing, accessing and performing operations on large data collections efficiently.

Uploaded by

ßryan Lou
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

Module 1: Introduction and Asymptotic Analysis

CS 240 - Data Structures and Data Management


Romain Lebreton
Based on lecture notes by A. Storjohann, R. Dorrigiv and D. Roche
David R. Cheriton School of Computer Science, University of Waterloo

Spring 2014

Lebreton (SCS, UW)

CS240 - Module 1

Spring 2014

1 / 48

Course Information
Instructors:
I
I

Romain Lebreton, DC 2304


rlebreton [at] uwaterloo.ca
Alex L
opez-Ortiz, DC 2339 (SE student only)
alopez-o [at] uwaterloo.ca

Lectures
I
I

Section 002: TTh 08:30am-09:50am in MC 2035


Section 003: TTh 02:30pm-03:50pm in MC 1056

Office hours:
I
I

Romain Lebreton : Thursday 4pm-5pm


Alex L
opez-Ortiz : Friday 11am-12pm

Lebreton (SCS, UW)

CS240 - Module 1

Spring 2014

2 / 48

Course Information
Tutors:
John Mok (MC 4065)
Patrick Lee
cs240 [at] student.cs.uwaterloo.ca
Office hours: TBA on the website
Tutorials:
Wednesday 09:30am-10:20am MC 4040
Wednesday 02:30am-03:20pm MC 4063
Wednesday 03:30pm-04:20pm MC 4042
Thursday 08:30am-09:20am OPT 1129
Tutorial this week on LATEX
Assignment 0 to learn LATEX
Lebreton (SCS, UW)

(5 bonus marks on assignment 1


CS240 - Module 1

Spring 2014

)
3 / 48

Course Information
Course Webpage:
http://www.student.cs.uwaterloo.ca/~cs240/s14/
Primary source for up-to-date information for CS 240.
I
I
I

Lecture slides
Assignments/Solutions
Course policies

Main resource: Lectures


I

Course slides will be available on the webpage before each lecture

Textbooks:
I
I
I

Algorithms in C++, by Robert Sedgewick, Addison-Wesley, 1998


More books on the webpage under Resources
Topics and references for each lecture will be posted on the Webpage

Lebreton (SCS, UW)

CS240 - Module 1

Spring 2014

4 / 48

Electronic Communication in CS240


Piazza
https://piazza.com/uwaterloo.ca/spring2014/cs240
A forum that is optimized for asking questions and giving answers.
You must sign up using your uwaterloo email address.
I

You can post to piazza using a nickname though

Posting solutions to assignments is forbidden.


Email
[email protected]
For private communication between students and course sta.
You should be sending email from your uwaterloo email address.

Lebreton (SCS, UW)

CS240 - Module 1

Spring 2014

5 / 48

Mark Breakdown
Final 50%
Midterm 25%
I

Tuesday, June 24, 4:30pm

Assignments 25%
I
I
I
I
I
I

5 assignments each worth 5%


Approx. every two weeks
Out/due on Wednesdays at 9:15am
No lates allowed
Follow the assignment guidelines
All assignment to be submitted
electronically via Markus

Lebreton (SCS, UW)

CS240 - Module 1

Spring 2014

6 / 48

Mark Breakdown
Final 50%
Midterm 25%
I

Tuesday, June 24, 4:30pm

Assignments 25%
I
I
I
I
I
I

5 assignments each worth 5%


Approx. every two weeks
Out/due on Wednesdays at 9:15am
No lates allowed
Follow the assignment guidelines
All assignment to be submitted
electronically via Markus

Lebreton (SCS, UW)

CS240 - Module 1

9
>
Note: You must pass
>
>
=
the weighted average of
the midterm and the final
>
>
>
; exam to pass the course

Spring 2014

6 / 48

Cheating

Cheating includes not only copying the work of another person


(or letting another student copy your work),
but also excessive collaboration.
Standard penalties: a grade of 0 on the assignment you cheated on,
and a deduction of 5% from your course grade. You will also be
reported to the Associate Dean of Undergraduate Studies.
Do not take notes during discussions with classmates.

Lebreton (SCS, UW)

CS240 - Module 1

Spring 2014

7 / 48

Courtesy

Please silence cell phones before coming to class.


Questions are encouraged, but please refrain from talking in class - it
is disrespectful to your classmates who are trying to listen to the
lectures.
Think about whether bringing your laptop to class will help you pay
attention or not.
Dont play games or watch videos that will distract your classmates.

Lebreton (SCS, UW)

CS240 - Module 1

Spring 2014

8 / 48

Advice

Attend all the lectures and pay attention!


Study the slides before the lectures, and again afterwards.
Read the reference materials to get dierent perspectives on the course
material.
Keep up with the course material! Dont fall behind.
If youre having difficulties with the course, seek help.

Lebreton (SCS, UW)

CS240 - Module 1

Spring 2014

9 / 48

Course Objectives: What is this course about?


The objective of the course is to study efficient methods of storing ,
accessing , and performing operations on large collections of data.
Typical operations include: inserting new data items, deleting data
items, searching for specific data items, sorting .
Motivating examples: Digital Music Collection, English Dictionary
We will consider various abstract data types (ADTs) and how to
implement them efficiently using appropriate data structures.
There is a strong emphasis on mathematical analysis in the course.
Algorithms are presented using pseudocode and analyzed using order
notation (big-Oh, etc.).

Lebreton (SCS, UW)

CS240 - Module 1

Spring 2014

10 / 48

Course Topics
priority queues and heaps
sorting, selection
binary search trees, AVL trees, B-trees
skip lists
hashing
quadtrees, kd-trees
range search
tries
string matching
data compression

Lebreton (SCS, UW)

CS240 - Module 1

Spring 2014

11 / 48

CS Background
Topics covered in previous courses with relevant sections in [Sedgewick]:
arrays, linked lists (Sec. 3.23.4)
strings (Sec. 3.6)
stacks, queues (Sec. 4.24.6)
abstract data types (Sec. 4-intro, 4.1, 4.84.9)
recursive algorithms (5.1)
binary trees (5.45.7)
sorting (6.16.4)
binary search (12.4)
binary search trees (12.5)

Lebreton (SCS, UW)

CS240 - Module 1

Spring 2014

12 / 48

Problems (terminology)

Problem: Given a problem instance, carry out a particular computational


task.
Problem Instance: Input for the specified problem.
Problem Solution: Output (correct answer) for the specified problem
instance.
Size of a problem instance: Size(I ) is a positive integer which is a
measure of the size of the instance I .
Example: Sorting problem

Lebreton (SCS, UW)

CS240 - Module 1

Spring 2014

13 / 48

Algorithms and Programs


Algorithm: An algorithm is a step-by-step process (e.g., described in
pseudocode) for carrying out a series of computations, given an arbitrary
problem instance I .
Algorithm solving a problem: An Algorithm A solves a problem if, for
every instance I of , A finds (computes) a valid solution for the instance
I in finite time.
Program: A program is an implementation of an algorithm using a
specified computer language.
In this course, our emphasis is on algorithms (as opposed to programs or
programming).

Lebreton (SCS, UW)

CS240 - Module 1

Spring 2014

14 / 48

Algorithms and Programs

For a problem , we can have several algorithms.


For an algorithm A solving , we can have several programs
(implementations).
Algorithms in practice: Given a problem
1

Design an algorithm A that solves . ! Algorithm Design

Assess correctness and efficiency of A. ! Algorithm Analysis

If acceptable (correct and efficient), implement A.

Lebreton (SCS, UW)

CS240 - Module 1

Spring 2014

15 / 48

Efficiency of Algorithms/Programs

How do we decide which algorithm or program is the most efficient


solution to a given problem?
In this course, we are primarily concerned with the amount of time a
program takes to run.
! Running Time
We also may be interested in the amount of memory the program
requires.
! Space
The amount of time and/or memory required by a program will
depend on Size(I), the size of the given problem instance I .

Lebreton (SCS, UW)

CS240 - Module 1

Spring 2014

16 / 48

Running Time of Algorithms/Programs

First Option: experimental studies


Write a program implementing the algorithm.
Run the program with inputs of varying size and composition.
Use a method like clock() (from time.h) to get an accurate
measure of the actual running time.
Plot/compare the results.

Lebreton (SCS, UW)

CS240 - Module 1

Spring 2014

17 / 48

Running Time of Algorithms/Programs


Shortcomings of experimental studies
We must implement the algorithm.
Timings are aected by many factors: hardware (processor, memory),
software environment (OS, compiler, programming language), and
human factors (programmer).
We cannot test all inputs; what are good sample inputs?
We cannot easily compare two algorithms/programs.
We want a framework that:
Does not require implementing the algorithm.
Is independent of the hardware/software environment.
Takes into account all input instances.
We need some simplifications.
Lebreton (SCS, UW)

CS240 - Module 1

Spring 2014

18 / 48

You might also like