Can we find index of an element in a treeset in java?
source link: http://codeforces.com/blog/entry/102868
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Is there any way to find index of an element in a treeset in java?
94 minutes ago, # |
why not? iterate over all elements, maintain a counter. when you meet your desired element you return the value of the counter. The time complexity is linear in size of the treeset. but I'm guessing this is not what you're looking for.
Everything is possible — Barrack Schwarzenegger, 2025.
Aggregate valuable and interesting links.
Joyk means Joy of geeK