CSCI 103 Algorithms and Problem Solving
Tutorial Exercises 3
October December 2016
Linked Lists
Stacks and Queues
Tutorial Exercises 3
Objectives
After the completion of these exercises, the student should be able to:
Traverse, search and delete nodes f
Examiners commentaries 2008
Examiners commentary 2008
05A Mathematics 1
Specific comments on questions Zone A
Question 1
The demand equation for a good is q(p + 3) = 4 and the supply equation is 2q p + 4 = 0 where
p is the price and q is the quantity. Ske
Examiners commentaries 2008
Examiners commentary 2008
97 Management accounting
Specific comments on questions Zone B
Question 1
Pinder Ltd has manufacturing divisions [For full question please refer to
examination paper].
This question examines transfer p
This paper is not to be removed from the Examination Halls
UNIVERSITY OF LONDON
279 0097 ZB
BSc degrees and Diplomas for Graduates in Economics, Management, Finance and the
Social Sciences, the Diploma in Economics and Access Route for Students in the
Ext
Examiners commentaries 2008
Examiners commentary 2008
32 Management science methods
Specific comments on questions Zone A
Section A
Answer one question from this section and not more than one
further question. (You are reminded that four questions in tota
Examiners commentaries 2008
Examiners commentary 2008
05A Mathematics 1
Specific comments on questions Zone B
Question 1
The demand equation for a good is q(2p + 3) = 8 and the supply equation is q 2p + 4 = 0 where
p is the price and q is the quantity. Sk
This paper is not to be removed from the Examination Halls
UNIVERSITY OF LONDON
279 004a ZB
990 004a ZB
996 D04a ZB
BSc degrees and Diplomas for Graduates in Economics, Management, Finance and the Social
Sciences, the Diploma in Economics and Access Route
This paper is not to be removed from the Examination Halls
UNIVERSITY OF LONDON
279 0091 ZB
BSc degrees and Diplomas for Graduates in Economics, Management, Finance and the
Social Sciences, the Diploma in Economics and Access Route for Students in the
Ext
FAMILIES OF DISTRIBUTIONS
Parametric Families: Functional form indexed by parameters (e.g. , 2 ) Each
member has a specific value for each parameter.
Exponential Family: A family of pdfs or pmfs is called an exponential family if it can be
represented as
USEFUL INEQUALITIES AND IDENTITIES
Numerical Inequalities:
Lemma 1: Let a,b be positive numbers and p,q be positive numbers greater than 1
satisfying:
1 1
1
1
+ = 1 , then a p + b q ab
p q
p
q
Holders Inequality: Let X, Y be any rvs and let p and q satisf
PROPERTIES OF A RANDOM SAMPLE
Background Concepts:
Def: The random variables X i ,i = 1,.n are called a random sample of size n from the
population f ( x ) if X i ,i = 1,.n are mutually independent random variables and the
marginal pdf (pmf) of each X i i
MINIMAL SUFFICIENT STATISTICS
If a statistic is sufficient, then so is an augmented statistic S ' ( S ,T ) . Since the goal is
to summarize information concisely, we desire to work with minimal sufficient
statistics.
Def: A statistic S= T ( X ) is minimal
RATIO OF LIKELIHOODS AS SUFFICIENT STATISTICS
Given two pdfs (or pmfs) f o ( x ) , f1 ( x ) and propose a statistic, S =
f1 ( x )
fo ( x )
(the ratio of
likelihoods) for a single observation. The two pdfs (pmfs) can (but need not be) the
same distribution
PRINCIPLES OF DATA REDUCTION
Goal: Make inferences about a parameter(s) in a family using a sample X i , i = 1,.n .
Data Reduction: Functions of the data called statistics may summarize all the information in the
sample about the parameter(s). This is oft
PRINCIPLES OF DATA REDUCTION
1. Def: Likelihood Function: If f ( x ) is the pdf (pmf) of X = ( X 1 , X n ) and we
observe X = x , the likelihood function of is L ( x ) = f ( x ) .
2. Def: Likelihood Principle: If x, y are two sample points (different samp
ANCILLIARY STATISTICS
Def: A statistic S ( X ) whose distribution is not a function of is an ancillary statistic.
Consider the situation where S is the minimal sufficient statistic for and the dim ( S ) > dim ( ) .
Then sometimes we can write S = (T,C ) .
BAYESIAN ESTIMATION
Assumptions:
Classical Inference: Parameters are constants that are unknown. They are
estimated from samples of data. The estimators are random variables.
Bayesian Inference: Parameters are random variables. The parameters of their
ass
POINT ESTIMATION
Def: A point estimator is any function W ( X 1 ,.X n ) of a sample.
So, any statistic is a point estimator but in order to be useful, estimators must have
good properties. We will study different methods of computing point estimators, the
Examiners commentaries 2008
Examiners commentary 2008
91 Financial reporting
Specific comments on questions Zone B
Question 1
The profit and loss accounts for the year ended 31 December 2007 for Sand
Plc, Sea Ltd [For full question please refer to the exa
This paper is not to be removed from the Examination Halls
UNIVERSITY OF LONDON
279 0032 ZB
BSc degrees and Diplomas for Graduates in Economics, Management, Finance and the
Social Sciences, the Diploma in Economics and Access Route for Students in the
Ext
Examiners commentaries 2008
Examiners commentary 2008
32 Management science methods
Specific comments on questions Zone B
Section A
Answer one question from this section and not more than one
further question. (You are reminded that four questions in tota
CSCI103 Algorithm and Problem Solving
Lecture Exercises 4
Lecture Exercises 4
Sorting and Searching
Question 1: Selection Sort
Trace the sort for every pass until the list of numbers is sorted in ascending order.
For each pass, indicate clearly the values
CSCI103 Algorithm and Problem Solving
Lecture Exercises 5
Lecture Exercises 5
Linked lists
sortList
3
count
55
70
80
head
Figure 1: sortList Linked List
Question 1: Defining and creating Linked List
(a) Define the data structures to create a linked list
CSCI103 Algorithm and Problem Solving
Lecture Exercises 3
Lecture Exercises 3
More on Problem Solving
Question 1
Peter and his three young children (Andrew, John and Matthew) want to
cross to the other side of the river. His boat can carry at most two per
CSCI103 Algorithm and Problem Solving
Lecture Exercises 1
Lecture Exercises 1
Introduction to Problem Solving
Question 1
Identify the start state, goal state, operators and constraints (if any) in the followin
g problem:
What is the result of 20 +234 X 56
CSCI 103 Algorithms and Problem Solving
Tutorial Exercise 1
October - December 2016
Introduction to Problem Solving
Pseudocode and Flowcharts
Tutorial Exercise 1
Objectives
After the completion of these exercises, the students should be able to:
Underst
CSCI 103 Algorithms and Problem Solving
Tutorial Exercises 2
Tutorial Exercises 2
October December 2016
More on Problem Solving
Sorting and Searching
Objectives
After the completion of these exercises, the student should be able to:
Understand the concep
Lecture 2
Pseudocode and Flowcharts
CSCI 103 Algorithms & Problem Solving
October December 2016
Topics
Flowchart
Pseudocode
Using Flowchart and Pseudocode
Basic Data Types
Basic Data Structures
Modularisation
CSCI 103
2
Recall:
Algorithm
An algorit
CSCI103 Algorithm and Problem Solving
Lecture Exercises 6
Lecture Exercises 6
Stacks and Queues
Question 1: Stacks
(a) The figure below shows a stack S implemented using a linked list.
Stack S
2
count
S24
S80
top
Draw a diagram to show the stack S after t
CSCI103 Algorithm and Problem Solving
Lecture Exercises 5
Lecture Exercises 5
Linked lists
sortList
3
count
55
70
80
head
Figure 1: sortList Linked List
Question 1: Defining and creating Linked List
(a) Define the data structures to create a linked list c