+ 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?
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
+ 2
Maybe this can help:
https://www.sololearn.com/Discuss/1240029/?ref=app