1.204 Computer Algorithms in Systems Engineering
Spring 2010
Problem Set 4: Satellite data sets
Due: 12 noon, Monday, March 29, 2010
1. Problem statement
You receive data from a series of satellites on cloud cover and atmospheric temperatures
on a nearrealtime basis.
Each satellite transmits a series of data points, represented as
an array, for the areas it can observe.
There are multiple satellites; sometimes their
measurement areas overlap, and sometimes there are gaps. To simplify the problem, we
will assume that the data can be sorted by one dimension (longitude) instead of two
(latitude and longitude).
The satellites report their data at approximately the same time, and you must merge all
the data you receive into a single array, sorted by longitude. The order in which the
satellites report appears random. They all report within a few seconds or even
milliseconds of each other, but the order is essentially unpredictable since it’s based on
their distance from the ground station, the processing time on the satellite to compute the
measurements and the number of measurements to transmit.
This is a common problem in monitoring and analyzing sensor data.
To solve it, you will
implement an optimal merge algorithm as outlined in the Horowitz text in section 4.7.
2. Algorithm
a. Merging two arrays
Section 3.4 in the textbook describes the mergesort algorithm, which recursively sorts an
array. The mergesort algorithm uses a helper algorithm, called merge, which is used for
merging two sorted subsets of an array. This is similar to how quicksort uses partition.
The merge algorithm works as follows.
Initially, you have two indexes pointing to the 0
th
elements of both arrays. These are the smallest elements in both the arrays as they are
sorted. You then choose the smaller of these two elements and this is the 0
th
element in
the new (result) array. You then update the index in the array from which you have
chosen the 0
th
element to the next element (1
st
element) and again compare the elements
to fill the 1
st
position in the sorted array. At each step, you compare the smallest element
in the two arrays and choose the smaller of them to fill the new array and update the
indexes accordingly until you fill the new array completely.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
As an example, consider the two arrays: {1,4,7} and {2,3,5},
which are sorted and have
to be merged into a single sorted array. The size of this sorted array is 6 (3+3).
The
figure below shows how the merge operation works for these two arrays. The two arrays
are represented vertically. The vertical lines separate the successive steps in the merge
algorithm. The circles represent the indexes. At each step of the algorithm, you compare
two elements (pointed to by the indexes) and choose the smaller of them to fill in the new
array.
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '10
 GeorgeKocur
 Array, Binary heap

Click to edit the document details