FAQ: Hash Maps: Conceptual - Saving Keys

Community%20FAQs%20on%20Codecademy%20Exercises

This community-built FAQ covers the “Saving Keys” exercise from the lesson “Hash Maps: Conceptual”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Computer Science

Complex Data Structures

FAQs on the exercise Saving Keys

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

If we want such a data structure where we want that keys should not be repeated and data should be stored in key value pairs, shouldn’t we use Dictionaries instead of Hash Maps because that would save us a lot of work. Hash Maps do the same tasks as dictionaries only difference is that dictionaries don’t have index. But I don’t think this would even make a difference because we can easily access key and value pair from a dictionary. Whereas, to make Hash Maps we need to do a lot like finding hash value for a key, making a index for an array out of that has value and length of array, then checking if multiple value exist, if so then append the key to the existing linked list. And not to mention, we would have to do lot of code for accessing our keys and values afterwards from that hash map.
Isn’t it more logical and easy to use Dictionaries instead of Hash Maps, if both do the same thing (saving data in key value pairs), where we could save our time and brain?

1 Like

You are absolutely correct. In fact, a Python dictionary is an implementation of a hash map. The purpose of these exercises on hash maps is to provide insight into how hash maps work, rather than to present them as something that should be implemented from scratch in an actual Python program to be developed for practical use.

4 Likes

So these are just being taught so that we understand what’s actually happening behind the scenes when we use different data structures in our code?

1 Like

Yes. Note that these lessons are included in the Codecademy Computer Science path. As a computer scientist, you might decide to develop a new programming language or to develop a new type of data structure for a language that you are already using. In either case, it would be very helpful to have knowledge regarding how particular data structures work, as well as to develop that understanding regarding data structures in general.

1 Like

Yes, I was actually planning to create an OS working on a completely new programming language.
This is really cool stuff.
Thanks @appylpye!

2 Likes

Well, then, it looks like you are in the right place. Best of luck to you, @armaanbarak . :smile:

3 Likes