If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Re: Need solution for some problems urgently!!!!

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.

Re: Need solution for some problems urgently!!!!

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!

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?

All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

Re: Need solution for some problems urgently!!!!

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.

Re: Need solution for some problems urgently!!!!

Originally Posted by dotnet13

lol yet to solve and actually even if I find 1 the time complexity will not be great for sure

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.