Jump to content

Hello everyone,

 

I am currently doing an exercise to learn how to use data structures and so on.

This one consists of a public partition managing program. Where in every partition there is a set of citizens and services.

The partitions are set like:

<City>,<partition number>,<Postal code>,<service  A>,…,<service N>

The citizens like:

<Name>,<Taxpayer number>,<email>,<posta lcode>,<partition number>

There are tickets to the services for a given day, they are set like:

<Taxpayer number>,<Service N>,<order number>

 

Now I have most  functions done but I don't know how to go about this one:

-Know the use of the services of a repartition knowing that a citizen gets one or more tickets and is destributedc by the "lists" of respective services

-Average time for solve a ticket is 10m, from 9:00h to 15:30h, should be able to know which citizens have been attended on a given ohur

(now the part that gets me confused)

-If a citizen is being attended in two services at the same time (confliting tickets) the order of the attendence should be given by the order number. In this case the citizen is attended in the second service righjt after he is done with the first, moving ahead on the waiting line of the second service and so on to the rest of the confliting tickets.

-Know what are the services who are most sought after

-Allow citizen to leave the line

 

I don't know how to go about this, what is the best structure to use for each? I have a Map of <Repartition,Set<Citizen>> and a doublylinkedlist of Repartitions. As well as TreeSets of CItizens and Tickets.

Link to comment
https://linustechtips.com/topic/846795-data-structures-need-help/
Share on other sites

Link to post
Share on other sites

Is there a bit more context for the problem? It's not 100% clear (at least to me) what the end game goal is for this. Are you attempting to simulate the ticket queue given a set of tickets, or make a system to which tickets can be added dynamically? Or both, with some kind of standardized "ticket script" that adds and removes tickets so you make the system and run it as well.

Gaming build:

CPU: i7-7700k (5.0ghz, 1.312v)

GPU(s): Asus Strix 1080ti OC (~2063mhz)

Memory: 32GB (4x8) DDR4 G.Skill TridentZ RGB 3000mhz

Motherboard: Asus Prime z270-AR

PSU: Seasonic Prime Titanium 850W

Cooler: Custom water loop (420mm rad + 360mm rad)

Case: Be quiet! Dark base pro 900 (silver)
Primary storage: Samsung 960 evo m.2 SSD (500gb)

Secondary storage: Samsung 850 evo SSD (250gb)

 

Server build:

OS: Ubuntu server 16.04 LTS (though will probably upgrade to 17.04 for better ryzen support)

CPU: Ryzen R7 1700x

Memory: Ballistix Sport LT 16GB

Motherboard: Asrock B350 m4 pro

PSU: Corsair CX550M

Cooler: Cooler master hyper 212 evo

Storage: 2TB WD Red x1, 128gb OCZ SSD for OS

Case: HAF 932 adv

 

Link to post
Share on other sites

add building number to cities line ,,, add rule buildings=#to# of citizens

citizens=ticketconflict return home(buildingnumber has open space)

citizens=in buildings unless ticketorder

citizens not need partition as thats resolved thru either building or ticketorder=service

Link to post
Share on other sites

On 17/10/2017 at 1:17 AM, reniat said:

Is there a bit more context for the problem? It's not 100% clear (at least to me) what the end game goal is for this. Are you attempting to simulate the ticket queue given a set of tickets, or make a system to which tickets can be added dynamically? Or both, with some kind of standardized "ticket script" that adds and removes tickets so you make the system and run it as well.

 

On 17/10/2017 at 2:19 AM, bcguru9384 said:

add building number to cities line ,,, add rule buildings=#to# of citizens

citizens=ticketconflict return home(buildingnumber has open space)

citizens=in buildings unless ticketorder

citizens not need partition as thats resolved thru either building or ticketorder=service

 

Sorry for late reply, I managed to solve it

Thank you for your time

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×