| | |
C++, difficulties in choosing STL 's containers
Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Nov 2006
Posts: 3
Reputation:
Solved Threads: 0
I have to redesign a bookshop programme which allow user to make order of books.
This programme is originally using vector to implement.Now i have to decide either use deque or hash_map for the programme or i would better keep using vector??
In fact, I just know these three kinds of containers in STL.Are there any other choices in STL???
Thank you so much~
This programme is originally using vector to implement.Now i have to decide either use deque or hash_map for the programme or i would better keep using vector??
In fact, I just know these three kinds of containers in STL.Are there any other choices in STL???
Thank you so much~
•
•
Join Date: Aug 2005
Posts: 14
Reputation:
Solved Threads: 3
hash-map(or hash tables) are usually used for getting retrieval of records in O(n) time... something you'd see in a database design. vector is probably the quickest and simplest way to go:
- its dynamically re-sizable
- you can access any element in linear time.
as your customer orders book, its as simple as pushing back the the book onto your order vector.
my vote says staty with the vector. but if you dont/ cant use a vector, theres always a linked list (doubly linked list) too.
- its dynamically re-sizable
- you can access any element in linear time.
as your customer orders book, its as simple as pushing back the the book onto your order vector.
my vote says staty with the vector. but if you dont/ cant use a vector, theres always a linked list (doubly linked list) too.
![]() |
Similar Threads
- Phonebook program! (C)
- Memory control with a vector (C)
- Can someone please help me with Binary Addtion. (C++)
- need some help please (C++)
- STL set vs. map (C++)
- Fast data storage (C++)
Other Threads in the C++ Forum
- Previous Thread: How to generate Graphics in Dev c++
- Next Thread: What does *&p do?
Views: 1173 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for C++
6 api array arrays based beginner binary bmp c++ c/c++ calculator char class classes code compile compiler console conversion convert count data delete deploy dll download dynamic encryption error file forms fstream function functions game givemetehcodez graph gui homeworkhelp iamthwee ifstream input int java lib library lines linkedlist linker list loop looping loops map math matrix memory microsoft newbie news number output pointer problem program programming project python random read recursion recursive reference return simple sort spoonfeeding stream string strings struct temperature template templates test text text-file tree url variable vector video visual visualstudio void win32 windows winsock wordfrequency wxwidgets





