smenjas / chemistry-explorer

A chemistry app built with vanilla JavaScript
https://smenjas.github.io/chemistry-explorer/
ISC License
1 stars 2 forks source link

Develop a sorting algorithm for molecular formulas #36

Closed smenjas closed 1 year ago

smenjas commented 1 year ago

The sorting algorithm must work for empirical and molecular formulas. Condensed formulas are not required for the first iteration.

For organic compounds, the pattern begins with carbon, then often lists other elements in order of atomic number. For example, CO2 would come before CF2.

smenjas commented 1 year ago

Formula sort has 2 bugs. It doesn't work when: