data structure and algorithms with coordinates

Viewed 26

I have a bad question again. I need a bit of help figuring out which data structure to use for the following issue.

We need a data structure that allows us to verify if we have taken that path already.

For example: I need to go to location B. but I never been there before, so I have my friend drive me there. The next day, I needed to go to location B again... Since I already recorded all the steps (coordinates) to get there, I should be able to reference some table that has all the steps to get there.

The day after, I need to go to location C. I have never been there, so my friend gets in the car. We realize that to get to location C, I can use the directions to location A with a slight difference at the end. So once we made it to an intersection where I don't know what to do, my friend would take over the wheel. I would then record the new set of steps to get to the new location.

The day after, I need to go to location C... Since I already recorded all the steps (coordinates) to get there, I should be able to reference some table that has all the steps to get there.

How would this data be stored? There is no way I can use an array. That would be too inefficient, right?

enter image description here

0 Answers
Related