Speak now
Please Wait Image Converting Into Text...
Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Challenge yourself and boost your learning! Start the quiz now to earn credits.
Unlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
General Tech Learning Aids/Tools 2 years ago
Posted on 16 Aug 2022, this text provides information on Learning Aids/Tools related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
Turn Your Knowledge into Earnings.
Lately I've seen many questions pertaining to Project Euler and similar that have problems with time limit exceeded. And this prompted the question, are these questions on topic? I mean, the code, while it produces the correct result, can be argued to be broken as it doesn't solve the problem (due to taking too much time). In other words, it doesn't provide any answer and thus doesn't work.
While I enjoy reviewing the algorithms, I can't help but to feel that sometimes the poster might only be interested in getting their score on whatever programming challenge site it is and simply uses this site to "cheat" and get the correct algorithm. Which isn't the purpose of CR I think, or is it? I'm quite unsure here.
How do you feel about this? Should "Time Limit Exceeded" be considered off topic and referred to Programmers? Or should we consider to give to correct algorithms? Sometimes you learn from just seeing how it is done too.
Performance problems are common in code presented in Code Review. The most valued reviews often point out ways to be more efficient.
Time limit exceeded (TLE) problems are performance problems where the performance is poor enough to cause an online judge to 'fail' the solution. Does the code produce the right result? Probably. Does it produce it in the right amount of time? No.
There are a few perspectives to have when looking at these problems:
Many of these judging systems are designed as tools to aid learning. Does posting a question to Code Review reduce the learning value of the question? No, and this is why:
At a point of crisis in the development of an algorithm, the right solution is to get a helpful hand and redirect, and an "education".
You have a valid concern when you say: "While I enjoy reviewing the algorithms, I can't help but to feel that sometimes the poster might only be interested in getting their score on whatever programming challenge site it is and simply uses this site to "cheat" and get the correct algorithm."
I think this does happen, but this is not really a problem we should concern ourselves with too much. The only person who suffers here is the person asking the question with a 'cheat' in mind. Our answers here are just one of many places where the person could find the answers. Sure, our answers here will be another place where other cheaters can find the results, but, it is one of many, and only the cheaters lose value. The people who have tried hard, and are struggling to find the right algorithm, and are looking for that next pointer, those are the ones with the most to gain from a review.
Additionally, the person suffering a TLE problem are not likely going to be able to simply reinvent the right algorithm. They have to get it from somewhere. Sure, a good Code Review answer will point out the right algorithm, it does not mean it has to write the whole program as well. Pointing out the right algorithm would be a useful part of a review. Only write out the full working solution if it is something that makes the review easy, or is something fun that you want to do anyway.
You say: "it doesn't provide any answer and thus doesn't work" and I counter that with no, the online judge failed to let it run long enough to produce the right answer.
I think there are a number of ways to look at this type of problem. On the one hand, the code fails the online judge, and that is the code's purpose, so the code just fails, and thus would be off-topic.
On the other hand, the code also works for the person who runs the code (just not for the judge). It works for them, and produces the right result for their input. They want it happening faster though. Still, to the best of their knowledge, it (will) work, if given the opportunity.
You are correct that the solution to these TLE problems is typically a complete rewrite of the core algorithm. The need to move from an 'obvious' implementation to a more obscure, technical, or mathematical approach.
Just because the code needs a rewrite does not mean that it is not ready for a review. It also does not mean you have to rewrite it. In many cases, a high-level review and a pointer to the right algorithm would be excellent feedback to the asker. An explanation of why their algorithm is slow is what they need, and a meaningful pointer to what the right solution is, would be much more of a learning experience than anything else available.
I believe these problems are just a special kind of performance problem, a problem where there's an objective 'judge' which fails code beyond a threshold.
The code is functional, and produces the right results (slowly).
The askers are normally quite frustrated when they ask, and need an insightful 'redirect' in a gentle way. Code Review is a good place for that.
Often the problems are interesting, and fun to work with.
You don't have to answer them all, just the ones that appeal to you, and maybe there's someone who finds this question appealing in turn.
Remember, Code Review should be a place that is fun to review things on too. If it does not look like fun, then don't do it.
No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.
General Tech 10 Answers
General Tech 7 Answers
General Tech 3 Answers
General Tech 9 Answers
General Tech 2 Answers
Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.