Attachment 31219Attachment 31221Attachment 31223Attachment 31225Attachment 31227
Printable View
It looks like you need to start working on some problems urgently so that you can come up with the solutions yourself.
ya but need efficient ones :( :( help will be really appreciable
I see. So, what are your current solutions and what makes you think that they are inefficient?
lol yet to solve and actually even if I find 1 the time complexity will not be great for sure
Well, look: you need to put in some effort. Think of something, implement it. If it is not good enough, you can ask for help in improving it. At the moment, all you're asking for is a code hand out.
hmm, that's unfair I guess
You guess wrong. If we hand out the code to you, we would have made several errors:
1-we would be blocking you from learning what you need to learn and so help to compromise your future
2-you would just left and wouldn't see that as our help should inspire you to help others also, so we would be helping you became more selfish.
3-we would be helping you to fool your teachers and so helping you to corrupt yoursef, so you may think you could do this every time
4-we would be loosing valuable time helping who deserves it and giving this time for someone who doesn't
among other things. So.... let's start to transform this mental fat in brain muscles... start to work. :)
Marking a post as 'urgent' does not get any faster/better answers from members. It just highlights to us that the post is relating to homework assignments!
If you have problems trying to get some code to work then if you post the code we'll try to provide advice and guidance - but you need to have first produced the code and made at least an attempt to get it to compile or to debug it if it compiles!
Please read
http://forums.codeguru.com/showthrea...ork-assignment
Before you start to code, you really need to first design the program - looking at the input, the data structures needed, the processing (logic and algorithms to use) and the output. Especially in problems like these, determining the logic/algorithms to use before starting to code is really important. Only once you are satisifed that the program design, algorithms etc are correct do you then start coding the design in a suitable language.
How far have you got with the design? With coding?
Actually everyone here misinterpreted what I have said, what I meant was that asking directly for code is not fair at all. Hope you guys will understand now :) :)
Problem 1 is Mr Yoo's problem (it clearly says so). Why are you doing his work ? :-)
problem 2 apparently only requires you to name the methodology, not actually write any code. it even has a time limit of 10seconds. I would expect your course books clearly have several methods outlined for such type problems and you need to identify the one used here.
The first would be an Interval Scheduling problem and the second a Vertex Coloring problem. But as the problems are formulated there doesn't seem to be any optimization involved so it should be quite straightforward.
In the first case you sort the meetings in start-time order and then assign them one by one to any free room. If all K rooms are occupied at some point in this process then bad luck. Someone is going to get angry but it's not in the task to avoid this. The meeting is cancelled and the assignment process continues with the next meeting in order. Meetings in progress can be kept in a set in end-time order. The meeting ending the soonest will always be first in that set, quick and easy to locate.
In the second case you generate all valid colorings systematically. The simplest approach is to recursively visit all vertexes probing possible colors in turn considering already assigned colors. This graph traversing process will generate a combinatorial tree with each leaf representing a valid coloring. Thanks to the Four Color Theorem it's assured at least one valid coloring exists.