Towards Sustainable Non-Volatile Memory: Machine Learning And Memory-Aware Data Structures For Energy Efficiency And Longevity