+ 1

struct Vs Tuple

Hi If we have only three data members and no other major operations is required on data members except to change last member as 0 or 1, what is better choice in terms of tuple or struct? My sample code where I am confused about tuple Vs struct is as below: https://code.sololearn.com/cidUTnEpVfdj which one is preferred in terms of space and time complexity?

30th Jun 2020, 8:09 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
2 Antworten
+ 1
Diff links help me finalize below: 1. Tuple takes considerably less time compared to struct 2. Tuple doesn't require comparator function for ascending order w.r.t. first field unlike struct require Below is sample code: https://code.sololearn.com/c4pE8i5LoRY9
3rd Jul 2020, 6:42 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
30th Jun 2020, 8:22 AM
Alexander Thiem
Alexander Thiem - avatar