Insert element into a vector of Nodes

Jun 3, 2016 at 5:22pm
Hi, guys!

I'm having a problem with something that shouldn't really be a secret since it seems simple to do it.
I'm trying to implement the Huffman code and my idea would be like this:
1
2
3
4
[1] -> [3] -> [2] 
 |      |      |
 v      v      v
[a]    [b]    [c]


The numbers represent the ammount of time the given letter has appeared in the string while the character, well .. it's the character itself.

I've declared a Node class (with right, left, valueInteger and valueCharacter) and the vector of Nodes (vector<Node> vectorOfNodes).
I'm trying to insert the tuple looking [1,a] into the first position but how can I do this?

Using the insert function isn't working and I can't seem to find a way to solve this.

Thanks in advance!
Last edited on Jun 3, 2016 at 5:23pm
Jun 3, 2016 at 11:22pm
In what way is std::vector::insert() not working? Does it not compile? Does it not do what you want? What?
Topic archived. No new replies allowed.