Home
Outline/Policy Summary Approach References Discussion Homework View Upload Problems: Categories Guidelines Solve UVA Archive Archive Mirror LSU Problems Coding Tips Contests: NA Qualifier Regional Extra: Grades Names (you should know) Class: CSC 2700 Section 01 Tureaud 116 Tuesday 6:30 PM - 8:30 PM Previous: 2013 Fall 2013 Spring 2012 Fall 2012 Spring 2011 Fall |
How to Approach Solving a UVA Problem
Requirements AnalysisBefore going any further, lets make sure we really understand the problem. Read and Understand the ProblemSuggestions:
Analyze the ProblemQuestions to answer before moving on:
DesignQuestions to answer?
Incremental Implementation Testing (testing in yellow)At this point, I would deviate a little from the classic Software Development Cycle. Because these problems are relatively small and time to implement is constrained, I would suggest doing iterative implementation and testing. In other words, right the overall program structure and make sure it compiles. The proceed through each section one at a time. This basic approach is a top-down design process. By going in this manner, you will avoid wiritng utility code that you never use (maybe you write a sort thinking you need and then realize you don't). Pretend the program is actually a big software system. First you implement the workflow structure (main program). Then you devlope each separate program/module in the system. So, in actuality, we are not deviating from the SDLC, we are simply using it recursively inside a single program.
InputWrite the code to load the data in. If complicated, write a dump function to display the imput to make sure it was loaded properly. Resist the temptation to do input inline of the processing. If the input is anything other than trivial, making the input logic and the processing logic work together can be tricky. Our goal is to simplify.
Base ProcessingNow start writing the asic processing code that you will need to solve the problem. As details or sub-processes come up make function calls for them. Then go write dummy function stubs as placeholders. Ge tthis basic logic working. At this point you also stuff in the desired output code. Here is a good chance to ensure that your planning has everything you need to output.
Iteratively fill in the stubsNow you should start writing the various utility functions you determined you needed (maybe a sort or search, or an insert, ...). As you write each one, compile it and test it as best as you can.
What to do if something goes wrong?The first step is to go back to the beginning:
Cannot figure out what algorithm to useThis might also be phrased as "I do not know where to start". In a contest, this means that you should not do this problem. Either someone else on the team needs to do it or it needs to be skipped. If everything else is done and you are doing this becuase time is left over, then soldier forward. Brainstorm. Work as a team on this. Resort to bottom up. Ge thte basic strucutre done. Make sure input works. Then start throwing code at it... If you are not in a contest, you have more options. Here are some:
Output for sample data is wrongHere are some things to do:
Run time errorThese can be frustrating. Here are a few ideas:
Sample data works, but Wrong Answer judgementThis is very similar to Run time error. Make sure you are testing all data cases.
|
The statements and opinions included in these pages are those of only. Any statements and
opinions included in these pages are not those of Louisiana
State University or the LSU Board of Supervisors.
© 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015