PDA

View Full Version : Contest Here..



vasanth
06-27-2002, 10:31 AM
Well i see that the contest here you have to submit the entire program.. DOnt you think it would be better where the contest requires you to write a function that takes particular arguments or inputs and returns the results.. SO the coder can concentrate more on the real function of the prog rather than the interface.. Testing it will also be easier and there will be less compatibility issues arrising out.. And this gets rid of people who copy codes from the net..( Well almost :) ).. The problem can be like write a function which takes the address of a char array as an input... The function should return the address of a new char array which holds all the permutation of the orginal array etc etc.. Does'nt this make things simpler for all.. :)

QuestionC
06-27-2002, 12:59 PM
Unless we specified exactly how we were going to call the function (basically, give them our driver), then the function apporach probably wouldn't be fair. Dunno about y'all, but I really despise being given a function to implement without some reasonably complete example of how the driver would use it.

Having someone write a function requires a lot more specification than just requiring that they submit a program that works. For some of the more difficult programs, the function would either have to use extern global variables specified in the contest, or return a lot of pointers that were passed by reference.
The logical way to write a big program would be to split it into a bunch of little functions that the main driver calls. If we want to have our submissions represent a coherent programming style, then we really need to either specify a lot of small functions, or just specify a program for them to submit, and let them decide what functions are logical to implement.

I can think of situations where instead of a program, we would need to use some standalone function, but I wouldn't expect that for any but a difficult program, and even then it should be the exception.

Shiro
06-27-2002, 02:54 PM
Having someone write a function requires a lot more specification than just requiring that they submit a program that works. For some of the more difficult programs, the function would either have to use extern global variables specified in the contest, or return a lot of pointers that were passed by reference.


Really? A program can be filled in by the programmer to do something. But the same counts for a function. You specify the input and the output and it is up to the programmer how to realize the output based on the input.

This realisation can be done within the function, or the programmer can decide to split up the function in more smaller functions.

There are some tough tasks such a function can perform, especially on the field of algorithms, just like Vasanth mentions.

But maybe then it comes too much to the field of algorithm design then programming.

ygfperson
06-27-2002, 05:25 PM
i'm not really for or against the idea. i don't believe the interface should be taking up that much time to create. this idea wouldn't significantly alter the contest as a whole.

personally, i don't think this idea is important enough to make a change to the contest. however, i'll check back at this poll in a day or two, and if there's broad support for it, i guess i could weave it in.

vasanth
06-27-2002, 08:11 PM
Well i do agree with every one here.. But submiting a function will make every ones entry standardised.. And th programmer can concentrate more on the program itself as i said earlier.. ANd i dont think it will be a problem to do complex problems.. The user can write many functions which can be used in the function needed to be written..


In the question an example can be given like.. The function should be like

*char funcion(int h,intk);

Dual-Catfish
06-27-2002, 08:14 PM
If the contest specifies that a function should be submitted, then yes. If the contest specifies complete source code.. then that should be submitted.

Although, I think it would be a great idea for a contest! Perhaps a Class contest could be next.. write a class which encapsulates so and so (For example, Matrices, or creating packets.)

vasanth
06-27-2002, 08:29 PM
I saw a similar contest in some site.. The question there was like this :-

You are given two strings (array of chars)- A and B. String A has N cells, and string B has M cells (3<=N,M<=250). You should write a function that will find the longest common sub-string that appears in both- A and B. Common sub-string, is a sequence of chars/ints that appears in the both strings, and from all such equal sub-strings, you should find the one which has greatest length.
For example:
A = 16121353f49ar44
B = 6q6353f0
True answer: 353f
Another example:
A = 1q12e13534a9
B = 67n8f87
True answer: 0 (there is no common sub-strings)

Function prototype:
char *find_substring(char A[], char B[], int N, int M);
or:
char *find_substring(char *A, char *B, int N, int M);

Which one you will use, depends on you. We don't mind no matter which one you will use.

Where:
A is the first array of chars/ints.
B is the second array of chars/ints.
N is the size of A (the number of cells)
M is the size of B (the number of cells)

Your function should return the longest common substring. If there is not such one, then, it should return 0.

Notice: In case there are two sub-strings with the same max length, return the last one.


and another one was like this


This time, you will have to read the input from a file.
An example input file is:

5
1 2
1 3
1 4
2 4
3 5
4 5

The program is about towns and "roads" between them. You will have to find if there is a road between given 2 towns.
The first line of the input file (green) is the number of towns (3<=N<=100).
All of the rest lines consists of two numbers, divided with a whitespace. The second line (blue) defines which towns you are looking path for. In this example, you are looking for road between Town 1 and Town 2. From the third line to the last one are defined the existing roads.
1 3- there is a road between Town 1 and Town 3
1 4- there is a road between Town 1 and Town 4
2 4- there is a road between Town 2 and Town 4
3 5- there is a road between Town 3 and Town 5
4 5- there is a road between Town 4 and Town 5

Having the input in the example, you are looking if there is a path (road, way), between Town 1 and Town 2. And in this example, there are two roads. The one is - 1 3 5 4 2, and the other is 1 4 2.

You have to write a function that finds out if there is a road between given 2 towns. There is no matter how long the road is... your function only have to find out if there is a path or not.

Function prototype:

int find_way(char *file_name);

Where file_name will be the name of the file you have to open and read.
Example function calling:

cout << find_way("data.inp");

In this case your function have to open data.inp and read it.

Your function should return 1 if there is a road, and 0 if there is no road between the given towns.


I think these kind of questions make a contest more intresting and there is less chances of people copying stuff from the net.. Believe it or not i had a temptation to copy the source from the net last time.. but resisted in doing so:) ANd it is also very easy to judged these.. It can be judged on various parameters like speed, accuracy, coding style etc etc.. Well it is uptoo you guys to take a decesion..

vasanth
06-28-2002, 04:45 AM
so will we have this kind of a contest this time :):D

Zeeshan
06-28-2002, 07:53 AM
Is it the same competition in which they'll be selecting representatives from India to SEARCC ISSC?

Shiro
06-28-2002, 11:13 AM
>Although, I think it would be a great idea for a contest! Perhaps
>a Class contest could be next.. write a class which encapsulates
>so and so (For example, Matrices, or creating packets.)

In fact a lot of types of contests could be organised. I don't know which one is best to handle, but several types of contests could be given a try, just to learn if it is good to handle or not.

ygfperson
06-28-2002, 01:29 PM
these types of contest warrant function-only submissions. my problem is with our types of contests. an rpg doesn't fit well into a function only. (not easily, anyway). i guess all functions could be copied directly from int main(), but to me it looks awkward.

i guess we could try it this time. i'll put the details in the signup thread.