hadifer
Badges: 8
Rep:
?
#1
Report Thread starter 1 year ago
#1
Just got my mocks back and realised how big of a difference there is between my computing paper 1 (theory) and paper 2 (programming) is. To me, the theory makes much more sense and I really struggle with algorithms and how to construct them. Does anyone have any tips on how to improve on paper 2?
0
reply
winterscoming
Badges: 19
Rep:
?
#2
Report 1 year ago
#2
The key to programming and algorithms is practice! Programming and algorithms are all about training your mind to 'think' computationally and solving problems, so it's not something you can learn by reading, note-writing or by simple repetition. There's really no other way to learn it than by sitting down with programming problems and trying to solve them using a programming language. (Any language is fine, including Python)

Here's a good mixture of problems to choose from which you can use to practice with:
https://www.ocr.org.uk/Images/202838...challenges.pdf
https://www.ocr.org.uk/Images/260930...es-booklet.pdf
https://www.hackerrank.com/domains/python
https://leetcode.com/problemset/all/?difficulty=Easy

Also, if you're trying to learn any specific algorithms (e.g. sorting/searching), then take time to write the code for those too - you can find a lot of places online which explain the different algorithms,but writing the code to make them work will help you understand them a lot more clearly than just reading about them (But of course, any videos or websites you can find which explain them may help in trying to figure out how to write the code)

Have you been using Python and 'IDLE' for writing code? If so, make sure you know how to use the debugger and breakpoints. -- https://www.cs.uky.edu/~keen/help/de...ial/debug.html - spending 15 minutes making sure you know how to 'step' through code and 'inspect' variables will help you see exactly what the code is doing - this is really important for helping to understand what your code is really doing and spotting errors or sanity-checking your assumptions about how something works.

Otherwise, you can do a similar thing without the debugger by making sure you output (print to screen) everything that your program is doing so that you can clearly see its progress step-by-step. Especially when writing 'loops', it's worth printing out the value of all the variables and lists in your program at each cycle/iteration to see how they change as a loop repeats (If you can format it on screen as a 'table' then that's even more useful because you'll be able to view it like a trace table)

Writing your own trace table can be good too, and anything else you feel you might need to draw out in order understand what the algorithm is doing and how it works. For example, if you're sorting a list it can be useful to see the full content of the list at each step along the way so that you can visualise changes in the shape or ordering of the list (items moving to different positions, or being added/removed to/from lists).

Lastly, unless the algorithm is really simple, don't try to solve the whole problem all at once; a lot of algorithms are complex and most people can't hold all of that in their head at once, so always start out just by solving a small sub-set of the problem just so that you get something basic which works, and you can build on top of it from there. Oftentimes it's easier to write several different small programs for trying different ideas and seeing how things work before bringing everything together.

Your first attempts might seem inefficient or inelegant - that's fine, as you spend more time doing this and get more practice you'll start to see a lot of patterns. Also, if you get completely stuck, then looking at a solution to get ideas about how other people think or approach problem solving can also help a lot - there are all kinds of 'clever tricks' which people discover in programming that aren't going to be obvious to you until you've spent time trying to figure it out for yourself.
Last edited by winterscoming; 1 year ago
1
reply
hadifer
Badges: 8
Rep:
?
#3
Report Thread starter 1 year ago
#3
(Original post by winterscoming)
The key to programming and algorithms is practice! Programming and algorithms are all about training your mind to 'think' computationally and solving problems, so it's not something you can learn by reading, note-writing or by simple repetition. There's really no other way to learn it than by sitting down with programming problems and trying to solve them using a programming language. (Any language is fine, including Python)

Here's a good mixture of problems to choose from which you can use to practice with:
https://www.ocr.org.uk/Images/202838...challenges.pdf
https://www.ocr.org.uk/Images/260930...es-booklet.pdf
https://www.hackerrank.com/domains/python
https://leetcode.com/problemset/all/?difficulty=Easy

Also, if you're trying to learn any specific algorithms (e.g. sorting/searching), then take time to write the code for those too - you can find a lot of places online which explain the different algorithms,but writing the code to make them work will help you understand them a lot more clearly than just reading about them (But of course, any videos or websites you can find which explain them may help in trying to figure out how to write the code)

Have you been using Python and 'IDLE' for writing code? If so, make sure you know how to use the debugger and breakpoints. -- https://www.cs.uky.edu/~keen/help/de...ial/debug.html - spending 15 minutes making sure you know how to 'step' through code and 'inspect' variables will help you see exactly what the code is doing - this is really important for helping to understand what your code is really doing and spotting errors or sanity-checking your assumptions about how something works.

Otherwise, you can do a similar thing without the debugger by making sure you output (print to screen) everything that your program is doing so that you can clearly see its progress step-by-step. Especially when writing 'loops', it's worth printing out the value of all the variables and lists in your program at each cycle/iteration to see how they change as a loop repeats (If you can format it on screen as a 'table' then that's even more useful because you'll be able to view it like a trace table)

Writing your own trace table can be good too, and anything else you feel you might need to draw out in order understand what the algorithm is doing and how it works. For example, if you're sorting a list it can be useful to see the full content of the list at each step along the way so that you can visualise changes in the shape or ordering of the list (items moving to different positions, or being added/removed to/from lists).

Lastly, unless the algorithm is really simple, don't try to solve the whole problem all at once; a lot of algorithms are complex and most people can't hold all of that in their head at once, so always start out just by solving a small sub-set of the problem just so that you get something basic which works, and you can build on top of it from there. Oftentimes it's easier to write several different small programs for trying different ideas and seeing how things work before bringing everything together.

Your first attempts might seem inefficient or inelegant - that's fine, as you spend more time doing this and get more practice you'll start to see a lot of patterns. Also, if you get completely stuck, then looking at a solution to get ideas about how other people think or approach problem solving can also help a lot - there are all kinds of 'clever tricks' which people discover in programming that aren't going to be obvious to you until you've spent time trying to figure it out for yourself.
thank you so much!! and yes I am using python, I shall make sure to practise as much as I possibly can!
0
reply
X

Quick Reply

Attached files
Write a reply...
Reply
new posts
Back
to top
Latest
My Feed

See more of what you like on
The Student Room

You can personalise what you see on TSR. Tell us a little about yourself to get started.

Personalise

Are you travelling in the Uni student travel window (3-9 Dec) to go home for Christmas?

Yes (137)
28.48%
No - I have already returned home (65)
13.51%
No - I plan on travelling outside these dates (93)
19.33%
No - I'm staying at my term time address over Christmas (45)
9.36%
No - I live at home during term anyway (141)
29.31%

Watched Threads

View All
Latest
My Feed