Best ADT for the Job?

Can anyone recommend an ADT for the following job:

I want to create an ADT that will house the current directory. I want to be able to add to the current directory, thus moving into a subdirectory, or delete from the current directory, thus moving into a parent directory.

I was thinking either a stack, or a doubly linked list.

What do you think?
You are looking for http://en.wikipedia.org/wiki/Tree_(data_structure)

I would implement one using std::list<Node*>

In other words you need a non linear data structure. Using a tree with recursive algorithms allows you to add and remove nodes (in this case folders) with ease of effort.

It is also extremely efficient asymptoticly.

I also recommend reviewing http://en.wikipedia.org/wiki/Big_O_notation



Last edited on
@johnnystarr: ¿why pointers?
Topic archived. No new replies allowed.