欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 科技 > 名人名企 > 为什么要学会写算法?

为什么要学会写算法?

2025/5/4 17:58:12 来源:https://blog.csdn.net/workflower/article/details/140284276  浏览:    关键词:为什么要学会写算法?

看到国外一个论坛上一个低年级学生发问,大概意思就是,他不用写算法就可以把程序写的很好。

实际上,写算法等于写解决问题的步骤,对于简单问题,即便不写算法,这步骤也在脑子里了,谁让这问题简单了。如果遇到复杂问题,还能靠脑子么?还是需要一个步骤、计划。

初学者看的编程教材,没有一个是教编程序逻辑的,都是教语法规则,所以那些题目自然都不是现实中的需求,都是经过设计之后的问题。比如那些基于排序衍生出的各种题目。

学编程,是学编程逻辑,是解决现实问题的逻辑,不是编程语法。

I'm in CS 1 and learning Java. I'm doing well (thank God), but one aspect that I'm just not understanding how to utilize correctly: Using the algorithm the correct way. I understand the point of algorithms, it always make sense to have a good, concrete plan to attack a problem and follow it.

My issue is, I think I almost have a harder time writing an algorithm. I'll be told to write an algorithm first, then code. Most of the time, I find myself sitting there for so long wondering hmm what should be done first... what 2nd, what third etc. What I'll end up doing, is skipping the algorithm, and just start coding without one. And I fill it in in reverse basically, doing the main code first and algorithm afterwards, just so show I did an algorithm.

I don't know if this sounds absolutely ridiculous or stupid. I am still new to this. Basically, I can work out code in my head while coding, and I move and correct myself as I go, and it almost always turns out nicely. It feels easier to me to code without having to write an algorithm first, because I don't know how to write said algorithm until I start seeing what things look like.

Does any of this make sense? Please tell me I'm not crazy, and make me realize that this is the wrong way to go about this. I'm sure if I become a developer one day, this habit will not work out at all.

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词