+ 4
Improving an algorithm
I am currently working on a code which can find isomers given the amount of carbon, hydrogen and oxygen atoms. The algorithm works, but is very slow... My algorithm: 1. Make a molecule with a C 2. Add it to the stack 3. While the stack is not empty -> get the first element of the stack -> if it's a valid molecule add it to a list -> add all possible paths from it to the stack 4.print list I hope somebody can improve it or find interesting ways to find isomers (rearrangements of molecules)
5 Antworten
+ 15
Although the task is different, it reminds me of this:
https://www.sololearn.com/post/65146/?ref=app
You can propose it as a challenge there:
https://www.sololearn.com/Discuss/1270852/?ref=app
try to give precise rules (atoms possible associations), and some solved test cases to put us on the way. It sounds interesting.
+ 2
Can you share also the actual code?
+ 2
https://code.sololearn.com/WK2JjDoYhYTi/?ref=app
... it works on my editor on my phone and computer but not on sololearn...
0
Learning seems simple but coding seems difficult
0
Any views about it??