怎么做我的项目(我对算法感到困惑) [英] How do make my project( i am confused of the algorithm)

查看:73
本文介绍了怎么做我的项目(我对算法感到困惑)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是问题

写一个接受任何形式的关系的程序(公鸡方法或0-1矩阵)

1.确定域名。叫它设置d

2.确定范围。叫它设置r

3.确定关系是对称的,反身的,传递的还是等价的

4.如果它的函数确定它是否为1-1,则为1 -1对应



我尝试了什么:



我没有'尝试过任何事情,因为我不知道怎么做

解决方案

首先考虑一下如何做到这一点。

得到一些论文,并尝试几个输入的例子,当你手动处理它们时会发生什么,以及你最终得到什么。

然后开始思考你将如何计算机化它。你需要什么输入?用户必须输入什么格式。为了让它们准备好处理,你需要对它们做些什么?你要对他们做些什么来确定这种关系?您需要什么输出?



然后开始考虑代码 - 并将代码分解为与您的逻辑匹配的模块(在C中,这将是函数)和数据)。然后开始对它进行编码,将每个阶段分成更小的位,直到你可以单独完成它们。

并且在你去的时候测试它!确定你的工作,然后再继续下一步。

试一试 - 这不是一项复杂的任务,并且有点想到它对你来说应该很简单。

here is the problem
write a program that accepts a relation in any form(rooster method or 0-1 matrix)
1. determine the domain. call it set d
2. determine the range. call it set r
3. determine if the relation is symmetric, reflexive, transitive or equivalence
4. if its a function determine if its 1-1, onto, 1-1 correspondence

What I have tried:

I haven't tried anything yet because I don't know how to make it

解决方案

Start by thinking how you would do this by hand.
Get some paper, and try a couple of examples of input, what happens to them as you process it manually, and what you end up with.
Then start thinking about how you would "computerise" that. What inputs do you need? What format does the user have to enter. What do you have to do to them in order to have them ready for processing? What do you have to do to them to determine the relation? What output do you need?

Then start thinking about code - and break the code into "modules" that match your logic so far (in C, that would be functions and data). Then start to code it, breaking each stage into smaller "bits" until you can do them individually.
And test it well as you go! Make sure what you have works, before you move on to the next bit.
Give it a try - it's not that complex a task, and with a bit of thought it should be pretty simple for you.


这篇关于怎么做我的项目(我对算法感到困惑)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆