473,387 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

does STL set have FindKth() functionality?

hello all,

i found set does not have a FindKth(), althought
it is realized using a red-black tree.

i have two questions:
1. is there any better SET?
2. can set be augmented?
thanks in advance.

best regareds.

May 10 '06 #1
2 1654

blackswift wrote:
hello all,

i found set does not have a FindKth(), althought
it is realized using a red-black tree.
Do you mean access by index? If so it can be implemented this way:

template<class T, class U, class V>
typename std::set<T, U, V>::const_iterator find_kth(std::set<T, U, V>
const& s, unsigned k)
{
typename std::set<T, U, V>::const_iterator i(s.begin());
std::advance(i, k);
return i;
}

Note that the complexity of this code is O(k), because std::set<> only
support bidirectional iterators.
i have two questions:
1. is there any better SET?
better than what?
boost::multi_index is often better than the standard associative
containers.
2. can set be augmented?


yes. http://www.sgi.com/tech/stl/set.html

May 10 '06 #2
thanks a lot!

May 10 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: DEN | last post by:
Hello, I need to remove toolbar and menubar from my current window (not opened with window.open, it would be too easy!!!). I've tried to use the window.toolbar.visible=false property, but it has...
2
by: bissatch | last post by:
Hi, I am currently writing a simple PHP program that uses an XML file to output rows for a 'Whats New' page. Once written, I will only require updating the XML file and any pages that use the...
38
by: Martin Marcher | last post by:
Hi, I've read several questions and often the answer was 'C knows nothing about .' So if C knows that little as some people say, what are the benefits, I mean do other languages know more...
22
by: Ryan M | last post by:
I've been programming for a while, but most of my experience is on unix. How do C compilers work on operating systems that weren't written in C? And that have no libc? Compiling C on unix seems...
2
by: Kjetil Bjerknes | last post by:
I'm currently creating some user controls in C#, and I've come across the interface IServiceProvider. This interface must be one of the worst examples of bad design I've ever seen. It contains one...
1
by: Mahesh Devjibhai Dhola | last post by:
Hi, I want to develop p2p (peer-to-peer) communication connection for chat in ..Net (Lang: c# - preferable) NOTE: if two LAN are behind their own router then also it should work as yahoo, msn...
3
by: Steve F. | last post by:
Hi, I have an ASP.NET page that needs to open in full screen mode for one of our intranet applications, yet, SP2 does not seem to allow that. Do you guys have any ideas how I could get around...
113
by: John Nagle | last post by:
The major complaint I have about Python is that the packages which connect it to other software components all seem to have serious problems. As long as you don't need to talk to anything outside...
162
by: Sh4wn | last post by:
Hi, first, python is one of my fav languages, and i'll definitely keep developing with it. But, there's 1 one thing what I -really- miss: data hiding. I know member vars are private when you...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.