Arrays & Hashing

What are Arrays?

  • Ordered collection of elements
  • Each element has an index, starting from 0
  • ["a","b","c"] - key for a is 0, b is 1 etc

What are Hashes?

  • Unordered collection of key-value pairs
  • Each value is retrieved from their corresponding keys
  • Implemented with dictionaries or maps
  • { name: "Alice" } - key is name and value is "Alice"

Resources

Concepts explained here are following those from Neetcode’s roadmap

.


Written By

GitHub Contributor Team