CS1020: Data Structure and Algorithms I
Tutorial 8 - Design and Analysis of Algorithms
5 April 2013
Solutions
1. [Fundamental of Big Oh Notation] Rearrange the following functions in
the increasing order of their Big Oh complexity:
(Hint: look up Stirling

CS1020 Lecture Note #8:
Analysis of Algorithms
Measuring amount of resources to run an
algorithm
Lecture Note #8: Analysis of
Algorithms
Objectives:
To introduce the theoretical basis for measuring the
efficiency of algorithms
To learn how to use such me

This course is intended for students in computing and related disciplines whose work focu
interaction issues in the design of computer systems. The course stresses the importance
and usability in the development of computer applications and systems. Stude

CS1020: Data Structures and Algorithms I
Tutorial 3 Problem Solving with Java Library and Java Generics
(15th February 2012)
Suggested Solutions
1. [Java Random Numbers] The Monte Carlo method uses repeated random sampling to
iteratively arrive at a more

CS1020: Data Structures and Algorithms I
Tutorial 2 Advanced Object Oriented Concepts
(8th February 2013)
1. [Object-oriented Design Principles] A Student class is used to keep track of students
within a school. Each student takes a maximum of 7 modules i

CS1020: Data Structures and Algorithms I
Tutorial 4 Abstract Data Types
(22nd February 2013)
1. [Abstract classes vs. Interfaces] An abstract class is one that contains some abstract
methods (abstract methods are methods without implementation). Below is

CS1020: Data Structures and Algorithms I
Tutorial 2 Advanced Object Oriented Concepts
(8th February 2013)
Suggested Solutions
1. [Object-oriented Design Principles] A Student class is used to keep track of students
within a school. Each student takes a ma

CS1020: Data Structures and Algorithms I
Tutorial 5 Linked Lists
(8th March 2013)
Suggested Solutions
1. [Linked List Merging] Using ListNode class and BasicLinkedList class provided in the
lecture notes, and given 2 linked lists whose nodes are in ascend

CS1020: Data Structure and Algorithms I
Tutorial 8 - Design and Analysis of Algorithms
5 April 2013
1. [Fundamental of Big Oh Notation] Rearrange the following functions in
the increasing order of their Big Oh complexity:
(Hint: look up Stirlings approxim

CS1020: Data Structures and Algorithms
Tutorial 6 - Stacks and Queues
15th March, 2013
1. [Stack and Queue Operations] In Java API Edition 7, we have the class LinkedList
which provides queue operations, source:
http:/docs.oracle.com/javase/7/docs/api/jav

CS1020: Data Structures and Algorithms I
Tutorial 4 Abstract Data Types
(22nd February 2013)
Suggested Solutions
1. [Abstract classes vs. Interfaces] An abstract class is one that contains some abstract
methods (abstract methods are methods without implem

CS1020: Data Structures and Algorithms I
Tutorial 7 - Recursion
22nd March, 2013
1. [Simple recursion problems]
a. Write a recursive solution along with its Java code to reverse an integer
array (not necessarily sorted). You cannot use any additional arra

CS1020: Data Structure and Algorithms
Tutorial 10 - Hashing
19 April 2013 (Solutions)
1. A good hash function is essential for good hash table performance. A good hash
function is easy to compute and will evenly distribute the possible keys. Comment on
th

CS1020: Data Structure and Algorithms I
Tutorial 9 - Sorting
12th April 2013
1. Perform merge sort on the following array:
5
9
12
7
8
51
31
12
2. Suppose you are required to sort 100,000 integers in ascending order. Given a
choice from 4 classic sorting a

CS1020: Data Structures and Algorithms
Tutorial 1 Java and Simple OOP
(1st February 2013)
1. [Basic Concepts and Coding]
a) The following is a code snippet used in an automated car park information system
to provide motorists information on available park

CS1020 Lecture Note #2:
Object Oriented
Programming (OOP)
A paradigm shift:
From procedural to object-oriented model
Lecture Note #2: OOP
Objectives:
Learn a few more classes in the API
Understand basic features of OOP
Able to use object-oriented modeling

CS1020 Data Structures and
Algorithms I
Lecture Note #1
Introduction to Java
Lecture Note #1: Intro to
Java
Objectives:
Able to start writing Java programs
Able to translate basic C programs learned in CS1010
into Java programs
Reference:
Chapter 1
Sectio

CS1020 Lecture Note #4:
Abstract Data Type
Walls
Lecture Note #4: ADT
Objectives:
Able to understand the need of data abstraction
Able to define ADT with Java Interface
(Java Interface: A group of related methods with empty bodies)
Able to implement da

CS1020: Data Structure and Algorithms
Tutorial 10 - Hashing
19 April 2013
1. A good hash function is essential for good hash table performance. A good hash
function is easy to compute and will evenly distribute the possible keys. Comment on
the performanc

CS1020 Lecture Note
#11:
Mix and Match
Combining data structures to solve problems
Lecture Note #11: Mix and
Match
Objective:
Using a combination of data structures to solve
problems
Outline
Mix and Match
Exam matters
[CS1020 Lecture 11 AY2012/3 S2]
2

CS1020 Lecture Note #6:
Stacks and Queues
Two basic linear data structures
Lecture Note #6: Stacks and
Queues
Objectives:
Able to define a Stack ADT, and to implement it with
array and linked list
Able to define a Queue ADT, and to implement it with
arra

CS1020: Data Structures and Algorithms
Tutorial 1 Java and Simple OOP
(1st February 2013)
Suggested Solutions
1. [Basic Concepts and Coding]
a) The following is a code snippet used in an automated car park information system
to provide motorists informati

CS1020 Lecture Note #9:
Sorting
Arranging elements in a list in order
Lecture Note #9: Sorting
Objectives:
To learn some classic sorting algorithms
To analyse the running time of these algorithms
To learn concepts such as in-place sorts and stable
sort

CS1020: Data Structures and Algorithms I
Tutorial 7 - Recursion
22nd March, 2013
Suggested Solutions
1. [Simple recursion problems]
a. Write a recursive solution along with its Java code to reverse an integer
array (not necessarily sorted). You cannot use

CS1020 Lecture Note #5:
List ADT & Linked Lists
Abstraction of a list
Lecture Note #5: List ADT &
Linked
Lists
Objectives:
Able to define a List ADT
Able to implement a List ADT with array
Able to implement a List ADT with linked list
Able to use Java AP

CS1020: Data Structures and Algorithms I
Tutorial 3 Problem Solving with Java Library and Java Generics
(15th February 2012)
1. [Java Random Numbers] The Monte Carlo method uses repeated random sampling to
iteratively arrive at a more and more accurate an

CS1020 Lecture Note #7:
Recursion
The Mirrors
Lecture Note #7: Recursion
Objectives:
To explain how recursion work
To demonstrate the application of recursion on some
classic computer science problems
To understand recursion as a problem solving
techniq

CS1020: Data Structures and Algorithms I
Tutorial 5 Linked Lists
(8th March 2013)
1. [Linked List Merging] Using ListNode class and BasicLinkedList class provided in the
lecture notes, and given 2 linked lists whose nodes are in ascending order of their v