CSC400 Final Exam Answer sheet
Name:_Emily Guinto_
Depaul id# _1485030_
Answer ALL the questions.
Show all your works for Part III in order to receive full credit !
Write your answers to Part I & Part II in the table below:
1
Part I (40pts)
F
11
T
1
Part
/Jonathan Younan
/CSC 383401
/jonyounan22@gmail.com
/SingleQueue.java
/101112
/This program is simulating a different queue for each of the 5 servers
import java.util.*;
public class IndividualQueues
cfw_
final static int arrivalTimeLimit = 3600;
fi
CSC400 Hw6
1. order the following functions by asymptotic growth rate:
210
4n
n3
4nlogn + 2n
3n + 100 log n
n2 + 10 n
2 logn
2n
n log n
2. Give a bigOh characterization, in terms of n, of the running time of the methods Ex1 to Ex4 ,
shown in Code Fragmen
The class Bag
For the class Bag<T> (with extendible array, defined
in "Bag.java" written in the 10/12 class), add the following
method:
public T remove(T elt)  This method searches
through the 'data' array to find the parameter 'elt', if it
exists, it s
The class LinkedList class (add selected methods from
Textbook Exercises on p. 164165)
Using the class LinkedList (singlylinked) shown in the class
lecture note on Lists, add the following methods.
Note that Java has a LinkedList class which is implemen
1.
Think Java, Chapter 7 (Iteration), Exercise 1.
o Create a new program, named LoopApp (thus
the class name is LoopApp and the filename has
to be "LoopApp.java"). Then copy the two
methods shown on the page into your program.
NOTE: There is an error in t
1. Write a program which computes the expected cost of
an item in a specified number of years. The program
asks for the cost of the item, the number of years from
now that the item will be purchased, and the rate of
inflation. The program then outputs the
Class MyLoan and an application
Name the class "MyLoan".
Write the class, and an application program in main(),
in the same file.
The class MyLoan should have the following members:
Private instance variables:
double amountBorrowed  the principal amou
Tiny Scrabble Game
This problem to implement a small application which
simulates the game of Scrabble. Your specific task is to
write two classes from scratch (LTile and RandomBag) and
complete an application class (tinyScrGame).
Class LTile  a tile in t
A A . A
if A A =

1
2
i

n
=
A + A
1
2
 +.+ 
A
n

j
AA
1
2
=
A + A
1
2

AA
1
2

A A A = A  +  A  +  A 
 A A  A A  A A + A A A 

1
2
1
n
 i =1Ai  =
3
2
1
1
n
 Ai 
i
2
3
3
2
n
 A A
i
i j
j
3
1
2
 + + (1) n  n=1 Ai 
Examples from the chapter 9 of the text
9.5.10 How many different ways to arrange the letters in the word MISSISSIPPI ?
Answer :
Answer =
1 M 4 Is 4 Ss 2 Ps
11!
4!4!2!
Balls in the boxes
9.6.2 How many ways to select 15 cans of soda with 5 different types
Combinatorics
The study of the number of ways to put
things together into various combinations.
E.g. In a contest entered by 100 people,
How many different top10 outcomes could
occur?
E.g. If a password is 68 letters and/or
digits,
How many passwor
import java.util.*;
public class MathamaticalFormulas cfw_
/ Mathamatical constants
final static double PI = 3.14;
final static double E = 2.71;
final static int BITS_PER_BYTE = 8;
final static int BITS_PER_NIBBLE = 4;
public static void main(String
/*
* Compilation: javac Queue.java
* Execution: java Queue < input.txt
* Data files: http:/algs4.cs.princeton.edu/13stacks/tobe.txt
*
* A generic queue, implemented using a linked list.
*
* % java Queue < tobe.txt
* to be or not to be (2 left on q
/DescriptiveStats.java
/Jonathan Younan
/Jonyounan22@gmail.com
/CSC 383401
/*This program will find the average value, mininum value, maximum value,
standard deviation, and median of a sequence of exam scores which are in the range 0 to 100*/
import ja
/ParseXML.java
/Jonathan Younan
/jonyounan22@gmail.com
/CSC 383401
/This program will parse through an XML file
import java.util.*;
public class ParseXML
cfw_
/This method will parse through a XML text file
public static void main(String[] args) cfw_
/Jonathan Younan
/MaxPQArrayList.java
/jonyounan22@gmail.com
/CSC 383401
/This program is about priority queues
/10252012
import java.util.*;
public class MaxPQArrayList<Key extends Comparable<Key>
cfw_
private ArrayList<Key> pq; /stores items on pri
Hw3
1. 1. Solve the following recurrence relation :
ak 7ak 1 10ak 2 k 2 with a0 a1 2
2. Solve the following recurrence relation :
ak 4ak 1 4ak 2 with a0 0 a1 1
3. a) Define F : Z Z by the rule F(n) = 2 3n, for all integers n,
i) Is F onetoone? (Prove o
Hw4
1. Determine whether the relation R on the set of all people is reflexive, symmetric, antisymmetric, and/or transitive, where (a,b) R if and only if
(a) a is taller than b.
(b) a and b are born on the same day.
(c) a has the same first name as b.
(d)
/ filename: autoboxing.java
/
/ This program demonstrates the 'autoboxing' in Java  a primitive
/ data types (int, double, char etc.) and their respective reference
/ types (Integer, Double, Character etc.) are automatically
converted
/ whenever applies