You are on page 1of 3

The University has a project to create a new social network for the students at

the university by integrating existing social networks managed by departments


and faculties.

The goal of the current exercise is to define and implement the different data
structures and algorithms supporting the mentioned social network according to
the requirements specified at each phase.

Considering that, in a first stage, the social network will include users of existing
social networks, you can consider that doubly linked lists can represent those
existing networks. The following classes are provided (please note that these
classes cannot be modified nor extended):

 A Student class to store information about each student. Its attributes


are:

o email: this is the electronic email for a student in the social


network. Emails addresses are unique nickname for the student in
the social network. Each username is unique, so two different
students cannot have the same email address.
o city: city of residence.
o campus (Getafe, Leganés, Colmenarejo): it has been
implemented as an enum type1, Campus, into the Student class.
o blocks: Users in the network can block other users to forbid them
communicating with them. This attribute stores the number of
times this student has been blocked
o date_sign_in: The date when the user registered in the social
network. The class java.time.LocalDate 2 has been used to
represent this data. This class does not store nor represent a
given hour or timezone, it just store the year, month and day of a
given date.

 A StudentsList class implementing the IList interface. It contains all the


students registered in a social network. A social network cannot contain
repeated students. For this reason, methods addFirst, addLast and
insertAt check if the student to be added or inserted already exists in the
social network.
In Phase 1 you must implement a class called ManageNetwork that must
include the following methods (which are also described in the provided
IManageNetwork interface):

1. Create a method, named union that joins two social networks into one
social network. The method takes two StudentsList objects and returns a
new list containing the elements of the first list and then the ones of the
second list.
2. Create a method getCampusCity taking a social network as input and a
parameter opc so that:
 If opc =1: the method must return a StudentsList containing all the
students residing in the same city that the campus where they are
studying.
 If opc =2: the method must return a StudentsList containing all the
students residing in cities different that the one where their campus is
located.
NOTE: The order in the result list must be the same than in the input list.

3. Create a method locateByCity taking a social network and a city name as


input and returning a list containing all the students who live in that city.
NOTE: The order in the result list must be the same than in the input list.

4. Create a method orderBy having a social network as input and a parameter


opc so that:
 If opc=1, the method returns a list of students sorted by ascending
order according to their email.
 If opc=2, the method returns a lit of students sorted by descending
order according to their email.
NOTE 1. You must implement your own ordering method based on
some of the existing ordering algorithms (such as bubblesort or sort) 3.
NOTE 2: Remember that you cannot modify or extend the StudentList
class. So, if an auxiliary method is needed it must be included in the
ManageNetwork class.
NOTE 3: The input list cannot be modified. The method must return a
new list with the students in the required order.

5. Create a method getStudentsByDateInterval, that takes a social network


(that is, an object of StudentsList class) and two dates (start and end, which
must be defined as java.time.LocalDate objects) as input, and returning a list
with all the students that got registered in the time interval defined by the
input dates.
You must consider the following comments:
a. start <= end
b. Both dates are included in the time interval
c. The order of the resulting list must be the same than the order given
in the input list.
6. Write a table with the Big-Oh functions for each ManageNetwork’s method.
Please, include a brief explanation for each method.