# ece351_final1 - Research

Λογισμικό & κατασκευή λογ/κού

1 Δεκ 2013 (πριν από 4 χρόνια και 7 μήνες)

77 εμφανίσεις

Question: #1

[20 points]

This question concerns graph coloring and cellular
telecomm systems.

Graph Coloring
: A k
-
coloring of an undirected
graph G(V, E) is a function c : V

{0, 1, …, k
-
1}
such that c(u)

c(v) for every edge (u, v)

E. In
other

words, the numbers 0, 1, …, k
-
1 represent
the k colors, and adjacent vertices must have
different colors. K is called the “Chromatic
Number” of G(V, E). Note that k is the minimum
possible number of colors to G.

Cellular Telecomm Systems
: In a cellular s
ystem,
the overall geographic area is divided into a
number of “Cells”. Each cell has a “Base Station”
that can send and receive signals from the mobile
users over a certain finite distance. Each cell
occurs as a natural result of the attenuation of
signal
s over the atmosphere. Communication
between any two mobiles (even if they are within
the same cell) is not direct; it occurs via the base
station. A wired network connects base stations to
the Public Switched Telephone Network (PSTN),
so that communicatio
n between any two mobiles
not within the same cell can also be supported.
Connecting the base stations to the PSTN also
allows communication between a mobile phone
and a landline phone.

Figure 1: A cellular system consists of mobile stations (users), ba
se
stations and a mobile switching center (MSC). The MSC is also called
a mobile telephone switching office (MTSO), since it is responsible for
connecting all mobiles to a PSTN in a cellular system.

The actual radio coverage of a cell, although
shown as a

regular hexagon in the figure above, is
amorphous in nature. The exact shape depends on
a variety of factors, and can change with time.
Some of the factors that result in distortion of the
cell are landscape and atmospheric conditions.

The frequency spect
rum allotted to the service
provider by the regulating government agency is
divided into several non
-
overlapping “carriers”
each mapped to a different frequency (this process
is called Frequency Division Multiplexing or
FDM). Each carrier is then further s
ub
-
divided
into several “channels” by way of Time Division
Multiplexing (TDM). A single channel forms the
basis of communication from a mobile user to a
base station.

Since signal strength fades with distance, cells
from neighboring areas have the maximum

potential for interference. However, interference
occurs only between signals using common
frequencies; it is negligible for signals using
different frequencies. Consequently, each base
station is allotted only a fraction of the total
number of channels a
vailable to the entire system,
and neighboring base stations are assigned
different groups of channels so as to minimize the
interference between base stations (and mobile
users under their control). By appropriately
spacing the base stations and their cha
nnels, the
frequency spectrum is distributed over the entire
service area with enough opportunity for spectral
reuse so long as interference is kept below
acceptable levels.

The cellular concept was thus a major
breakthrough in solving the problem of spect
ral
congestion and scaling with user demand.

(a)

(Free Gift) Show how graph coloring can be
used in Efficient Frequency (Spectrum)
Planning of Cellular Telecomm Networks, i.e.
explain how the two problems are the same.
You
r answer must show the 1
-
1 mapping
between the concepts in the two problems.

(b)

Provide two more practical applications of
graph coloring.

(c)

Show that any tree is 2
-
colorable.

(d)

Show that the following are equivalent:

G is bipartite.

G is 2
-
colorable.

G has no od
d cycles of odd length.

(e)

Let d be the maximum degree of any vertex in
a graph G. Prove that G can be colored with
d+1 colors.

(f)

Show that if G has O(V) edges, then G can be
colored with O(

V) colors [Optional/Bonus
question].

Question: #2

[60 points]

This question concerns OO Analysis, Design and
Programming as also Software Engineering,
Project Management and Databases.

Application Programming

C++ or Databases
?
Consider a figure skating competition with 3
events
-

men’s only, women only and couples
.
Someone could participate in only one or both
possible events. In a year there are 3 competition
seasons: Fall, Winter & Spring. Each event is
judged by 8 judges, with each judge involved in 1
or more events per season. Scoring is out of 10, the
highest
and the lowest scores are dropped and the
rest averaged. There are 5 possible routines for
each event: Men

M1 to M5, Women

W1 to W5,
Couples

C1 to C5. For every individual and
couple who has participated in a competition you
will maintain the raw sc
ores (scores from 8
judges), the net score (final average for the event)
and the routine performed for the last 2 years. Also
maintain for all the judges, the scores they gave for
every routine for the last 2 years. Create a record
of all the events for th
e last 2 years.

Year 1

Fall

o

Men’s: 8 participants

o

Women’s: 10 participants

o

Couples: 6 couples

Winter

o

Men’s: 12 participants

o

Women’s: 14 participants

o

Couples: 8 couples

Spring

o

Men’s: 7 participants

o

Women’s: 10 participants

o

Couples: 6 couples

Year 2

Fall

o

Men’s: 10 participants

o

Women’s: 8 participants

o

Couples: 5 couples

Winter

o

Men’s: 8 participants

o

Women’s: 14 participants

o

Couples: 6 couples

Spring

o

Men’s: 10 participants

o

Women’s: 9 participants

o

Couples: 8 couples

Assume that there are 12 judges overall w
ho have
judged an event in last 2 years, the last names of
all the participants and the judges will be unique.
Print out all the data: raw and net score, routine,
participant name and also judge information for
the last two years. Sample output should be
-

Year #1:

Fall

o

Men’s

Participant 1: raw scores, net score,
routine.

Participant n: raw scores, net score,
routine.

Judge 1: score, routine, for all routines.

Judge n: score, routine, for all routines.

o

Women’s (as above).

o

Couples (as above).

Winter (as in Fa
ll).

Spring (as in Fall).

Year #2 details would be similar to year 1.

Note

that you won’t be keeping track as to what
score a judge gave a particular participant.

After printing all this information, at
command line the program should give the
following
options:

(a)

Find which routine was held more than once in
a given season.
OR

Find the net score of a
competitor for a given event.
OR

Find the
average score of a competitor over all the last
two years.

(b)

Find set of individuals who competed in any
events in a g
iven season.
OR

Find set of
individuals who competed in all events held in
a given season.

(c)

Find the judge who awarded the lowest score
during a given event.
OR

Find the judge who
awarded the lowest score for a given figure.

(d)

[Important] Can you solve this p
roblem using
a database and SQL queries i.e. no C++ code?
Discuss in detail. [Hint: see the OO paradigm
assignment].

This question should be approached as in the first
programming assignment. Submit:

CRS as given above with clarifications if any.

Design D
ocuments

System Diagram, Class
Diagram, Object Diagram, Activity Charts and
Use
-
Cases specifications. Use UML Notation.

Project planning and costing.

Actual software (C++) and Test cases.

Project Documentation.

Question: #3

[20 points]

These quest
ions concern techniques from sorting
and searching algorithms as well as graph theory.

Parallel Computers & Parallelizing Compilers
:
Consider the following algorithm that computes
the sum of x
1
, x
2
, …, x
8
:

Sum := x
1
;

For i = 2 to 8

Sum := Sum + x
i
.

Note

that the execution of this algorithm requires 7
units of time if we assume that it takes 1 unit of
time to add two numbers. Now, assume that we
have a large number of processors that can be
used to do additions in parallel. We may employ
the following alg
operations in each “do in parallel” statement are
assumed to be carried out on simultaneously on
different processors. Consequently, execution of
this algorithm requires 3 units of time.

Do in parallel

x
1

:= x
1

+ x
2
;

x
3

:= x
3

+ x
4
;

x
5

:= x
5

+ x
6
;

x
7

:= x
7

+ x
8
;

Do in parallel

x
1

:= x
1

+ x
3
;

x
5

:= x
5

+ x
7
;

Sum := x
1

+ x
5
;

We assume a model of parallel computation in
which there are infinitely many processors that
operate simultaneously. In one unit of time, a
processor can access
a fixed number of registers,
carry out one arithmetic, logical or comparison
operation, and store the results in a fixed number
of registers.

(a)

What criteria will you use to partition a given
code into parallel segments? i.e. as the
compiler writer for a par
allel computer, how
will you determine when to translate the
sequential code snippet 1 into the parallel code
written a small
-
scale compiler… our famous
Prog
-
1 assignment remember?]

(b)

Using a model of parallel co
mputation, design
an algorithm similar to that presented above
for finding the sum of 2
k

numbers. What is the

(c)

Design a parallel algorithm that determines
the maximum of 2
k

numbers. What is the time
rithm?

(d)

Design a parallel algorithm that determines
the number of positive numbers among 2
k

numbers. What is the time complexity of your
algorithm?

[Hint: Precedence/Dependency graphs might help
you here].

OR

VLSI chip testing
: Professor Diagnose has n
sup
posedly identical VLSI chips that in principle
are capable of testing each other. The professor’s
test jig accommodates two chips at a time. When
the jig is loaded, each chip tests the other and
reports whether it is good or bad. A good chip
always reports

accurately whether the other chip is
be trusted. Thus, the 4 possible outcomes of a test
are as follows:

Chip A

Chip B

Conclusion

B good

A good

B good

B b

A good

(a)

Show that if more than n/2 chips are bad, the
professor cannot necessarily determine which
chips are good using any strategy based on
this kind of pair
-
chips conspire t
o fool the professor.

(b)

Consider the problem of finding a single good
chip from among n good chips, assuming that
more than n/2 of the chips are good. Show that

n/2

pair
-
wise tests are sufficient to reduce
the problem to one of nearly half the size.

(c)

Show t
hat good chips can be identified with
O(n) pair
-
wise tests, assuming that more than
n/2 of the chips are good. Give and solve the
recurrence that describes the number of tests.

(d)

How much time will professor Diagnose need
to complete his testing?

(e)

Now assume
that he has a parallel computer at
his disposal. Can he speed up the time he
needs to complete his testing? If not explain
why. If yes, calculate the speedup factor. State
all assumptions explicitly and explain where
you are using them.

Question: #4

[20 points]

This question concerns computer networks and
graph theory.

Intranet & Internet Routing
:

(a)

Find shortest paths from node G to all other
nodes using Dijkstra’s algorithm. Specify all
nodes along a path and

the total weight of the
path.

Fig 2:
Finding the shortest path in an Intranet

(Dijkstra’s) Algorithm.

(b)

Find a minimum
-
spanning tree for the graph
above using Kruskal's algorithm. Provide a
practical application of MST’s in the context of
wired networks.

Fig 3:Finding a Min
imal Spanning Tree.

(c)

Graph Traversal
: The diameter of a tree T(V,
E) is given by
);
,
(
max
,
v
u
V
v
u

i.e. the
diameter is the largest of all shortest path
distances in the tree. Give an efficient
algorithm to compute the diameter of a tree,
and analyze

the running time of your
algorithm. Now, repeat the above problem for
an arbitrary graph G(V, E) [Optional/Bonus
Question].

(d)

Graph

Paths
: Suppose that a weighted
directed graph has a negative weight cycle.
Give an efficient algorithm to list the vertices

of one such cycle. Prove that your algorithm is
correct and analyze its running time.

Question: #5

[20 points]

This question concerns data structures for internal
and external storage.

Memory v/s Hard Disk
:

(a)

Explain why Red
-
Black Trees (or any for
m of
balanced trees) are the preferred data
structure for data stored in the RAM.

(b)

Explain the problems a B
-
Tree could possibly
cause when used for data that is intended to be
accessed from RAM.

(c)

Explain why B
-
Trees and not Red
-
Black Trees
(or any form of ba
lanced trees) are the data
structure of choice for persistent storage.

(d)

Relate the design parameters of the B
-
Tree to
those of the hard disk (e.g. node size,
#children, disk page size etc).

Question: #6

[20 points]

to analyze a new
data structure.

Data Structures
: You are asked to analyze a new
data structure called the “Left Heavy Tree” which
obeys the following rules

Key (parent (x))

Key (x). (Thus the root is the
smallest key).

Shortest path to a null link c
oincides with a
path through right descendants.

Fig 4.

Fig 5.

For example the tree in fig 4 is left heavy, but the
one in fig 5 is not. (Since node B has a null link at
a distance 1 from its left and a null link at a
distance 2 from its right).

(a)

H
ow will you MERGE 2 left
-
heavy trees?

(b)

How will you EXTRACT the minimum (and
maintain left
-
heavy structure on the resulting
tree)?

(c)

Show that length of right spine is O(log n).

[Hint: Study the heap structure carefully. The left
heavy tree is similar to the
heap in many respects].

Questions #7 through #10

[10 points each]

These questions are basic math and optimization
problems.

Operating Systems
: Suppose that a hypothetical
Operating System has a set of tasks to schedule
onto a large number of processes/t
task has a start and finish time. By Compatible
tasks, we mean those whose execution times do not
overlap. The creation of each separate process is
expensive and the application is not time sensitive
(i.e. we are in no hurry to quickly finish
in other words, massive parallelization is not
necessary). As the designer of the operating
system, you are asked to write its scheduler so as
to use as few resources (processes/threads) as
possible. Provide an efficient algorithm for this
sch
eduler. Discuss the time complexity of your
algorithm. Prove that no adversary will be able to
outperform you. [Hint: This is an example of a
Greedy Algorithm].

Source Coding & Compression
: Show that no
compression scheme can expect to compress a file
of
randomly chosen 8
-
bit characters by even a
single bit [Hint: Compare the number of files with
the number of possible encoded files].

Linear Algebra
: You are given (n x n) matrices A
and B. If matrix multiplication is O(n
3
), show that
matrix inversion is a
lso O(n
3
). [As an aside, you
might be surprised to learn that matrix
multiplication can be done in less than O(n
3
).
Strassen came up with a scheme that does it
O(n
log
2
7
). Others have done it even faster i.e. in
O(n
2.36
), but their multiplication constants
(that the
O
-
notation hides) are big].

Mathematical Induction
: The professor summoned
the best students in the class to his office to find
out how smart they were. The professor told them:
“I have placed white hats on some of you and
black hats on the othe
rs. You may look at, but not
talk to, one another. I will leave now and come
back every hour on the hour. Every time I return, I
want those of you who have determined that you
are wearing white hats to come up and tell me
immediately”. As it turned out, at

the nth hour
every one of the n students who were given white
hats informed the professor that he knew that he
was wearing a white hat. How?

[That’s it! You are a free bird!!]