Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Swift Basics (retired) Collections What is a Dictionary?

Ross Freeman
Ross Freeman
5,522 Points

How is the order determined for a dictionary?

I know the video says that the order doesn't mean anything for dictionaries in Swift, but what determines the order it prints out?

1 Answer

Dylan Shine
Dylan Shine
17,565 Points

Hi Ross,

That's a really great question. The answer unfortunately is quite complex and I wouldn't do it any justice by typing out what goes into the hashing algorithm but you can find more general information from this Wikipedia page http://en.wikipedia.org/wiki/Hash_table.

Hope that helps,

Dylan

Ross Freeman
Ross Freeman
5,522 Points

I'll take a look at it and see if I could try to understand it. Thanks!