Embedded
SQL and
JDBC
Why Embedded SQL?
For complex queries and applications
Gives the capabilities of SQL and a high level
language like C+ or Java.
There are many :
PRO*C/C+, PRO*COBOL, PRO*FORTRAN, ODBC, JDBC, SQLJ,
Prerequisites
(these must all be
SELECT
SELECT . AS . FROM .WHERE . ORDER BY .
LIKE, IS NULL
AVG, MIN, MAX, SUM, COUNT
set operations
cartesian product
GROUP BY
HAVING
nested queries
JOIN
RESERVES
SID
BID
BOATS
Day
Deposit
23
109
01/08/2014
120
23
108
08/08/2014
120
25
101
08/08/20
Section 3
Entity-Relationship Models
Section Outline
Why do we need the ER model?
ER modelling constructs
Designing an ER model
Translating an ER model into a relational
database schema
Why do we need an ER model?
A database design is for a whole organis
What do these ER diagrams mean?
1) a student can take 0.N courses
2) a student can take 0.1 courses
3) a student can take 1.N courses
4) a student takes exactly 1 course
A) a course can have 0.N students
B) a course can have 1.N students
C) a course can h
Question 1
[10 Marks]
(a) What is the time complexity of an algorithm? Give the main reason why analysis of
algorithms is important. [3]
The time complexity of an algorithm is the amount of time [1] the algorithm takes to solve a
problem expressed as a fu
University of Cape Town
Department of Computer Science
Computer Science CSC2001F
Class Test 1, 19 March 2015
Marks: 35
Time: 45 minutes
Instructions: Answer all questions
Show all calculations where applicable
The use of calculators is permitted
Approxima
University of Cape Town
Department of Computer Science
Computer Science CSC2001F
Class Test 2, 11 May 2011
Marks:
Time:
Instructions:
35
45 minutes
Answer all questions
Show all calculations where applicable
The use of calculators is permitted
Approximate
Question 1 [6 marks]
An SRC needs a database of students and societies. Each society has a unique name,
membership fee that it charges students to join, and funding from the university.
Every society must have at least 40 members; its university funding i
University of Cape Town
Department of Computer Science
CSC2001F
Mock Solutions
1 March 2016
Solutions
Question 1
[6 Marks]
Give the Big O complexity for the following code pieces Briefly
justify each answer.
[1]
[2]
[2]
[1]
Question 2
[12 Marks]
a) Write
CSC2001F:
Non-Linear Data Structures and
Algorithms: Introduction
Geoff Nitschke
Department of Computer Science
University of Cape Town, South Africa
Overview
Analysis of Algorithms: Asymptotic (Big-O) Notation.
Recap: What is a Data Structure?
Its an abs
CSC2001F:
Non-Linear Data Structures and
Algorithms: Introduction
Geoff Nitschke
Department of Computer Science
University of Cape Town, South Africa
Overview
Big-O
Recursion
Algorithms and Code Structures Example
int partialSum = 0;
for ( int I = 0; I <
CSC2001F:
Non-Linear Data Structures and
Algorithms: Introduction
Geoff Nitschke
Department of Computer Science
University of Cape Town, South Africa
Course Overview
Data Structures 1 module:
Teaching Assistant:
Data Structures and Problem Solving Using J
CSC2001F:
Non-Linear Data Structures and
Algorithms:
AVL Trees
Geoff Nitschke
Department of Computer Science
University of Cape Town, South Africa
BST Operations and Efficiency
BST: is a linked structure similar to the linked list.
BST improves on linked
CSC2001F:
Non-Linear Data Structures and
Algorithms: Trees
Geoff Nitschke
Department of Computer Science
University of Cape Town, South Africa
Overview
Recurrence Relations
Trees
What is a Recurrence Relation?
A recurrence relation, T(n), is a recursive f
CSC2001F:
Non-Linear Data Structures and
Algorithms:
Binary Search Trees
Geoff Nitschke
Department of Computer Science
University of Cape Town, South Africa
Binary Trees Definition
An ordered tree is a tree for which the order of the children
of each node
CSC2001F:
Non-Linear Data Structures and
Algorithms AVL Trees
Geoff Nitschke
Department of Computer Science
University of Cape Town, South Africa
AVL Trees
Adelson-Velsky & Landis (1962):
1. A node of a tree is balanced if the heights of its
children diff