811312A Tietorakenteet ja algoritmit , Python-kielinen harjoitustyö

Samankaltaiset tiedostot
Choose Finland-Helsinki Valitse Finland-Helsinki

FinFamily PostgreSQL installation ( ) FinFamily PostgreSQL

On instrument costs in decentralized macroeconomic decision making (Helsingin Kauppakorkeakoulun julkaisuja ; D-31)

The CCR Model and Production Correspondence

Tietorakenteet ja algoritmit

Salasanan vaihto uuteen / How to change password

Capacity Utilization

Information on preparing Presentation

Security server v6 installation requirements

Efficiency change over time

Network to Get Work. Tehtäviä opiskelijoille Assignments for students.

Security server v6 installation requirements

Information on Finnish Language Courses Spring Semester 2018 Päivi Paukku & Jenni Laine Centre for Language and Communication Studies

Rekisteröiminen - FAQ

812336A C++ -kielen perusteet,

Other approaches to restrict multipliers

16. Allocation Models

Information on Finnish Language Courses Spring Semester 2017 Jenni Laine

Olet vastuussa osaamisestasi

Rekisteriseloste. Rekisterinpitäjä. Yhteyshenkilö rekisteriä koskevissa asioissa. Rekisterin nimi. Henkilötietojen käsittelyn tarkoitus

Information on Finnish Courses Autumn Semester 2017 Jenni Laine & Päivi Paukku Centre for Language and Communication Studies

AYYE 9/ HOUSING POLICY

Festo Online Shop käyttöohje.

Lab SBS3.FARM_Hyper-V - Navigating a SharePoint site

Infrastruktuurin asemoituminen kansalliseen ja kansainväliseen kenttään Outi Ala-Honkola Tiedeasiantuntija

ETELÄESPLANADI HELSINKI

Asiakaspalautteen merkitys laboratoriovirheiden paljastamisessa. Taustaa

Curriculum. Gym card

7.4 Variability management

Voice Over LTE (VoLTE) By Miikka Poikselkä;Harri Holma;Jukka Hongisto

MUSEOT KULTTUURIPALVELUINA

Mobility Tool. Demo CIMO

1. Liikkuvat määreet

Alternative DEA Models

TIEKE Verkottaja Service Tools for electronic data interchange utilizers. Heikki Laaksamo

Returns to Scale II. S ysteemianalyysin. Laboratorio. Esitelmä 8 Timo Salminen. Teknillinen korkeakoulu

The Viking Battle - Part Version: Finnish

Ajettavat luokat: SM: S1 (25 aika-ajon nopeinta)

Arkkitehtuuritietoisku. eli mitä aina olet halunnut tietää arkkitehtuureista, muttet ole uskaltanut kysyä

EUROOPAN PARLAMENTTI

Sisällysluettelo Table of contents

Käyttöliittymät II. Käyttöliittymät I Kertaus peruskurssilta. Keskeisin kälikurssilla opittu asia?

On instrument costs in decentralized macroeconomic decision making (Helsingin Kauppakorkeakoulun julkaisuja ; D-31)

Capacity utilization

You can check above like this: Start->Control Panel->Programs->find if Microsoft Lync or Microsoft Lync Attendeed is listed

SELL Student Games kansainvälinen opiskelijaurheilutapahtuma

Results on the new polydrug use questions in the Finnish TDI data

FIS IMATRAN KYLPYLÄHIIHDOT Team captains meeting

Data protection template

KONEISTUSKOKOONPANON TEKEMINEN NX10-YMPÄRISTÖSSÄ

make and make and make ThinkMath 2017

SIMULINK S-funktiot. SIMULINK S-funktiot

CASE POSTI: KEHITYKSEN KÄRJESSÄ TALOUDEN SUUNNITTELUSSA KETTERÄSTI PALA KERRALLAAN

FinFamily Installation and importing data ( ) FinFamily Asennus / Installation

RINNAKKAINEN OHJELMOINTI A,

Collaborative & Co-Creative Design in the Semogen -projects

Tietoa Joensuun Eliittikisoista

LUONNOS RT EN AGREEMENT ON BUILDING WORKS 1 THE PARTIES. May (10)

9/11/2015 MOBILITY TOOL+ ERASMUS+ Learning Mobility of Individuals. M a n a g e m e n t. I s s u e. T o o l

Rotarypiiri 1420 Piiriapurahoista myönnettävät stipendit

Use of spatial data in the new production environment and in a data warehouse

On instrument costs in decentralized macroeconomic decision making (Helsingin Kauppakorkeakoulun julkaisuja ; D-31)

1.3 Lohkorakenne muodostetaan käyttämällä a) puolipistettä b) aaltosulkeita c) BEGIN ja END lausekkeita d) sisennystä

SENAATTILA uudistuu keväällä 2015

Office 2013 ja SQL Server 2012 SP1 uudet BI toiminnallisuudet Marko Somppi/Invenco Oy

1. SIT. The handler and dog stop with the dog sitting at heel. When the dog is sitting, the handler cues the dog to heel forward.

BDD (behavior-driven development) suunnittelumenetelmän käyttö open source projektissa, case: SpecFlow/.NET.

Lapuan myöntämä EU tuki SOLUTION asuinalueille omakoti- tai rivitaloa rakentaville

NAO- ja ENO-osaamisohjelmien loppuunsaattaminen ajatuksia ja visioita

LX 70. Ominaisuuksien mittaustulokset 1-kerroksinen 2-kerroksinen. Fyysiset ominaisuudet, nimellisarvot. Kalvon ominaisuudet

IFAGG WORLD CUP I, CHALLENGE CUP I and GIRLS OPEN INTERNATIONAL COMPETITION 1 st 2 nd April 2011, Vantaa Finland

Business Opening. Arvoisa Herra Presidentti Very formal, recipient has a special title that must be used in place of their name

LANSEERAUS LÄHESTYY AIKATAULU OMINAISUUDET. Sähköinen jäsenkortti. Yksinkertainen tapa lähettää viestejä jäsenille

HARJOITUS- PAKETTI A

Guidebook for Multicultural TUT Users

Uusi Ajatus Löytyy Luonnosta 4 (käsikirja) (Finnish Edition)

Mat Seminar on Optimization. Data Envelopment Analysis. Economies of Scope S ysteemianalyysin. Laboratorio. Teknillinen korkeakoulu

4x4cup Rastikuvien tulkinta

Tiedote/Newsletter 8/2016

Tarua vai totta: sähkön vähittäismarkkina ei toimi? Satu Viljainen Professori, sähkömarkkinat

811312A Tietorakenteet ja algoritmit, , Harjoitus 5, Ratkaisu

anna minun kertoa let me tell you

Korkeakoulujen tietohallinto ja tutkimus: kumpi ohjaa kumpaa?

Erasmus Charter for Higher Education Hakukierros kevät 2013 Anne Siltala, CIMO

Aiming at safe performance in traffic. Vastuullinen liikenne. Rohkeasti yhdessä.

C++11 seminaari, kevät Johannes Koskinen

truck Check In. truck Check Net. ewaybill ja ajat suoraan terminaaliin

APPLICATION GUIDE BSP Finland

National Building Code of Finland, Part D1, Building Water Supply and Sewerage Systems, Regulations and guidelines 2007

Portugalin tasavallan aloite neuvoston päätökseksi Schengenin konsultointiverkoston (tekniset eritelmät) osan 1 muuttamisesta

Paikkatiedon semanttinen mallinnus, integrointi ja julkaiseminen Case Suomalainen ajallinen paikkaontologia SAPO

Bounds on non-surjective cellular automata

Uusia kokeellisia töitä opiskelijoiden tutkimustaitojen kehittämiseen

Group 2 - Dentego PTH Korvake. Peer Testing Report

Windows Phone 7.5 erilainen ja fiksu älypuhelin. Vesa-Matti Paananen Liiketoimintajohtaja, Windows Phone Microsoft Oy

DOORSin Spreadsheet export/import

1.3Lohkorakenne muodostetaan käyttämällä a) puolipistettä b) aaltosulkeita c) BEGIN ja END lausekkeita d) sisennystä

Tutkimusdata ja julkaiseminen Suomen Akatemian ja EU:n H2020 projekteissa

Suunnittelumallit (design patterns)

3 9-VUOTIAIDEN LASTEN SUORIUTUMINEN BOSTONIN NIMENTÄTESTISTÄ

Transkriptio:

811312A Tietorakenteet ja algoritmit 2016-2017, Python-kielinen harjoitustyö Tämä harjoitustyö toteutetaan Python-kielellä. Monet matkustajat saapuvat Ouluun käyttäen useiden matkatoimistojen palveluja. Eräs oululainen yritys haluaa luoda tehokkaan järjestelmän matkanjärjestäjiltä kerätyn tiedon hallitsemiseksi. Sinun tehtäväsi on implementoida osa tästä järjestelmästä; tiedot tallennetaan ohjelmassa kahteen binääriseen etsintäpuuhun ja kahdentyyppisiin linkitettyihin listoihin. Alkutiedot luetaan ohjelmaan neljästä tiedostosta. Muokattujen tietojen tallennusta tiedostoihin ei tarvitse toteuttaa. Ensimmäiseen listaan tallennetaan tiedot matkatoimistoista. Listan jokainen solmu sisältää seuraavat tiedot: Tunnus (Yksikäsitteinen) Nimi Rekisteröintipäivä Henkilökunnan lukumäärä Johtajan nimi Solmut lajitellaan tunnuksen perusteella. Ohjelman aluksi tiedot luetaan tekstitiedostosta (agencies.txt); tiedoston jokainen rivi kuvaa matkatoimistoa. Rivillä ovat yllämainitut kentät mainitussa järjestyksessä tabulaattorilla erotettuina. Päivämäärät esitetään tässä työssä muodossa vvvv.kk.pp. Ensimmäinen binääripuu sisältää asiakkaiden tiedot. Puun jokaisessa solmussa säilytetään sitä vastaavasta asiakkaasta seuraavia tietoja: Tunnus (jokaiselle asiakkaalle yksikäsitteinen) Nimi Puhelinnumero Osoite Tunnusta käytetään asiakkaan paikan määräytymiseen puussa (sitä käytetään siis puun solmujen avaimena). Ohjelman aluksi tiedot luetaan tekstitiedostosta (customers.txt); tiedoston jokainen rivi kuvaa asiakasta. Rivillä ovat yllämainitut kentät mainitussa järjestyksessä tabulaattorilla erotettuina. Toinen binääripuu sisältää matkatoimistojen kuljettajien tiedot. Kuten asiakkaiden tapauksessa, puun solmussa säilytetään yhden kuljettajan tietoja: Tunnus (jokaiselle kuljettajalle yksikäsitteinen) Nimi Työhön ottamisen päivä Automalli

Tässäkin tapauksessa tunnusta käytetään puun solmujen avaimena. Ohjelman aluksi tiedot luetaan tekstitiedostosta (drivers.txt); tiedoston jokainen rivi kuvaa kuljettajaa ja rivi on seuraavaa muotoa: Kuljettaja_tunnus Kuljettajan_toimisto_tunnnus Nimi Palkkauspäivä Automalli Rivin kentät on erotettu tabulaattoreilla. Huomaa, että koska jokainen kuljettaja on jonkin matkatoimiston palkkaama, rivin toinen kenttä on matkatoimiston tunnus. Jokaisella kuljettajalla on oma listansa, jossa säilytetään tietoja hänen toimittamistaan palveluista (matkoista). Jokaiseen kuljettajaan siis liittyy linkitetty lista, jonka solmuissa ovat seuraavat tiedot: Tunnus (kullekin matkalle yksikäsitteinen) Matkan päivä ja kellonaika Asiakkaan tunnus Lähtöpaikka ja päämäärä Saatu palkkio (euroissa) Ohjelman aluksi tiedot luetaan tekstitiedostosta (travels.txt); tiedoston jokainen rivi kuvaa matkaa ja rivi on seuraavaa muotoa: Matkan_tunnus Kuljettajan_tunnus Päivä_ja_aika Asiakkaan_tunnus Lähtöpaikka Päämäärä Palkkio Rivin kentät on erotettu tabulaattoreilla. Huomaa, että koska jokainen matka liittyy kuljettajaan, rivin toinen kenttä on matkan suorittaneen kuljettajan tunnus. Ohjelmaan on toteutettava seuraavat toiminnot: Matkatoimiston etsiminen nimen tai tunnuksen perusteella Kuljettajan etsiminen nimen tai tunnuksen perusteella Asiakkaan etsiminen nimen tai tunnuksen perusteella Palveluoperaatiot: matkan lisääminen, poistaminen ja etsiminen Käytä ohjelmasi pohjana tiedostoja Classes.py ja main.py jotka sisältävät matkatoimistojen tietojen lataamiskoodin. Ohjelmaan tulee toteuttaa seuraavat funktiot: Funktio, joka muodostaa listan annetun asiakkaan saamista palveluista (tehdyistä matkoista) aikajärjestyksessä. Funktio, joka muodostaa listan asiakkaista, jotka ovat hankkineet palveluita annettujen päivämäärien välisenä aikana. Funktio, joka muodostaa listan kuljettajista, jotka ovat palvelleet annettua asiakasta (tunnistetaan asiakastunnuksen perusteella). Kuljettajat listataan järjestyksessä nimen perusteella. Pyri käyttämään mahdollisimman tehokasta tapaa saada em. tulokset.

Arvioi funktioittesi aikakompleksisuutta matkatoimistojen, asiakkaiden, kuljettajien ja matkojen lukumäärän suhteen. Mittaa myös ohjelmasi suoritusaikoja testisyötteillä ja arvioi ovatko ne yhdenmukaisia analyysisi kanssa. Ohjelmakoodin lisäksi palautetaan työselostus, jossa kuvataan 1. ratkaisu ja 2. ohjelman suorituskyvyn analyysi, kuten edellä mainittiin. Analyysi sisältää siis käytettyjen algoritmien analyysin ja ohjelman suoritusaikojen mittaukset. Ohjelmakoodin tulee olla asiallisesti kommentoitu, mutta muuta dokumentointia ei vaadita. Työselostukseen liitetään luonnollisesti myös nimi ja opiskelijanumero. Mikäli haluat, voit antaa työselostuksessa myös palautetta työstä, esimerkiksi tehtävään käytetty työmäärä, työn helpot ja hankalat asiat ja mitä opit työtä laatiessasi. Muutakin palautetta voi antaa. Muista pakata tiedostot yhdeksi pakkaukseksi ennen palauttamista. Tehtävän ratkaisu on palautettava viimeistään 15.2.2017.

811312A Data Structures and Algorithms 2016-2017, Python Assignment This assignment shall be implemented in Python. In Oulu, many passengers arrive in their destinations using services provided by multiple travel agencies. A team in Oulu wants to manage and control these agencies by collecting different sets of data from them. Hence, this team intends to create an efficient system to collect, store and manipulate their data. In this assignment, you have to implement a part of such a system. This system should be implemented using two binary search trees and two linked lists. The initial data are read from four different files. You do not need to implement storing of manipulated data. The first list stores the information about the travel agencies. Each node in this list contains the following information: ID Unique Name Registration Date Number of staff members Manager s name The nodes in this list should be sorted based on the ID. Initially the agencies are read from a text file (agencies.txt); each line represents an agency with the fields separated by tabulators. The fields are stored in the order presented above. Dates are represented in the form yyyy.mm.dd in this assignment. The first binary tree only includes the information for customers. Each node in this tree represents a customers with the following information: ID unique for each customer Name Phone number Address ID is used as the key to decide the correct place for each customer (The tree is sorted based on the customer ID). Initially the customers are read from a text file (customers.txt); each line represents a customer with the fields separated by tabulators. The fields are stored in the order presented above. The second binary tree contains the information for the drivers in each travel agency. Similar to the previous case, each node in this tree represents a driver with the following information: ID unique Name Hiring Date Car model

Similarly, ID is used as the key for this tree as well. Initially the drivers are read from a text file (drivers.txt); each line represents a driver and lines are of form Driver_ID Driver_Agency_ID Name Hiring_Date Car_model with the fields separated by tabulators. Note that, because a driver belongs to an agency, the second field is the agency s ID. The fields are stored in the order presented above. Every node in the first linked list contains instances of these two binary search trees with the specific information obtained from them. Different agencies do not have access to the customer and driver data from the other agencies (other nodes in the linked list). Each driver has a list of his own, containing the information regarding his/her services (travels). This is the second linked list that should be implemented in this project. Every driver node in the driver binary tree should have a linked list member containing the following information: ID unique travel id travel Date and time customer ID Source and destination Received amount (euros) Initially the travels are read from a text file (travels.txt); each line represents a travel and lines are of form Travel_ID Driver_ID Date_and_time Customer_ID Source Destination Payment_amount with the fields separated by tabulators. Note that, because a travel is associated with a driver, the second field is the driver s ID. The fields are stored in the order presented above. This program should be able to do the following: Agency operations: search for an agency Driver operations: search for a driver Customer operations: search for a customer Driver services operations: add service, delete service, search for a service Use as a basis the files Classes.py and main.py that contain code for loading the agencies file. The following should be implemented by you: Write a function that shows the number of services requested by a customer, sorted by date. Write a function that shows the list of customers who have received services from different agencies from date 1 to date 2 sorted by date. Write a function that shows the list of drives who have served a specific customer (search by ID) sorted by the driver names.

In each case use efficient data structures and algorithms for returning the results. Estimate the time complexity of the functions, in terms of the number of agencies, customers, drivers and travels. Also, measure the running times of your functions with test inputs try to deduce if your estimate and measurements are in concordance. In addition to program code, you shall return a report that describes 1. the solution, and 2. analysis of program s performance as mentioned above. Analysis contains thus the analysis of the used algorithms and the measurements of program s running times. The code shall be commented but no other documentation is required. The report shall naturally contain student s name and student number. If you wish, you can also give feedback in your report. Remember to zip the files before returning. The assignment shall be returned by 15.2.2017.