I want to Implementing Set in C++ without using STL.
I don't have problem with implementing.
I don't understand the concept. I don't know how can I show set in c++ with array?
Creating a set by using an array is part of implementing it, though, unless I'm misunderstanding your question. It wouldn't be very efficient for large data sets, but as a start you could just have a set contain an array of whatever type the set is, and then iterate through the set to see if there are any matches before adding a new item.
I'd say it's most likely for a set to either be implemented as a hash table or as a tree.
Or are you just talking about printing? If so, can you be more specific in what the issue with printing is?
- iterate over the elements of the array as long as the new element < existing element
- When new element == existing element replace it otherwise insert.