In a project where memory efficiency and speed are of utmost priority and the data doesn't need any modification once set, which data structure would be a better choice?

  • Dictionary
  • List
  • Set
  • Tuple
Tuples are an excellent choice when memory efficiency and speed are crucial because they are immutable and consume less memory compared to lists. Their immutability also ensures that data integrity is maintained, making them suitable for scenarios where data should not be modified after initialization.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *