×

# Unique elements in 2D vector

 0 How can i find Set of Unique Elements In 2d Vector in most EFFICIENT WAY?? Vector Declaration :  vector par[100000];  Example : Input : 1,2,3,4 1,4,3,2 1,2,3,4 5,4,2,9 8,6,5,4 1,2,3,4 Output : 1,2,3,4 1,4,3,2 5,4,2,9 8,6,5,4 asked 10 Aug, 14:40 72●6 accept rate: 0%

 2 You can make trie type structure or you can also use unordered map.. For trie type structure, at each level you would store a column in sorted manner and insert and find element accordingly.. This link may help.  1 5 8 2 4 4 6 3 3 2 5 4 2 9 4  This is how your trie will look like.. Hope this will help.. answered 10 Aug, 15:57 1.0k●1●9 accept rate: 19% 1 Hey Thanks for it @kauts_kanu. :) (10 Aug, 16:19) Thanks!!!! (10 Aug, 18:55)
 1 Do you want to perform some operations on the resultant 2D matrix? How about inserting them in a set of vectors. I guess you want a more efficient way compared to NlogN.(N is the unique number of elements in set). Still thinking an efficient way.:) answered 10 Aug, 15:03 214●7 accept rate: 8% Thanks!! Learned something new!! (10 Aug, 18:56)
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×62
×11