Slide 21
Slide 21 text
countϓϩύςΟ
Complexity: O(1) if the collection conforms to
RandomAccessCollection; otherwise, O(n), where n is the length of
the collection.2
ʮίϨΫγϣϯ͕ RandomAccessCollection ϓϩτίϧʹ४ڌ͠
͍ͯΔ߹ O(1)ɺͦͷଞͷ߹ O(n)ʯ
2 https://developer.apple.com/documentation/swift/collection/2885508-count
SwiftϓϩάϥϚͷͨΊͷࠓ͞Βฉ͚ͳ͍ܭࢉྔͷ / iOSDC Japan 2017 / © Hisakuni Fujimoto, 2017 21