algorithm || method to write prog
- by fatai
I am one of the computer science student. My wonder is everyone solve problem with different or same method, but actually I dont know whether they use method or I dont know whether there are such common method to approach problem.
All teacher give us problem which in simple form sometimes, but they dont introduce any approach or method(s) so that we can first choose method then apply that one to problem , afterward find solution then write code.
I have found one method when I failed the course,
More accurately,
When I counter problem in language , I will get more paper and then ;
first, input/ output step ;
my prog will take this / these there argument(s) and return namely X ,
ex : in c,
input length is not known and at same type ,
so I must use pointer
desired output is in form of package ,
so use structure
second, execution part ;
in that step , I am writing all step which are goes to final output
ex : in python ;
1.) [ + , [- , 4 , [ * , 1 , 2 ]], 5]
2.) [ + , [- , 4 , 2 ],5 ]
3.) [ + , 2 , 5]
4.) 7 ==> return 7
third, I will write test code
ex : in c++
input : append 3 4 5 6 vector_x remove 0 1
desired output vector_x holds : 5 6
But now, I wonder other method ;
used to construct class :::: for c++ , python, java
used to communicate classes / computers
used for solving embedded system problem ::::: for c
Why I wonder , because I learn if you dont costruct algorithm on paper, you may achieve your goal. Like no money no lunch , I can say no algorithm no prog
therefore , feel free when you write your own method , a way which is introduced by someone else but you are using and you find it is so efficient