Find Jobs
Hire Freelancers

C++ class to enumerate sets

$30-75 USD

Completed
Posted about 17 years ago

$30-75 USD

Paid on delivery
The project is building an object which returns all enumerated n-sized subsets of a vector. Calling next should go to next lexicographically ordered unique subset. These subsets are represented as vectors of iterators of the original type. The original ContainerT is a std::vector. Construction should be O(N), and next should be O(N). Constructor should throw exception if set_size > [login to view URL](). template class enumerated_subset { public: typedef typename ContainerT::iterator container_iter_type ; typedef typename std::vector subset_type ; enumerated_subset ( std::size_t set_size, ContainerT & container ) ; bool next ( ) ; /// Return true so long as not last iteration subset_type const & current ( ) const ; /// return reference to local current subset state private: subset_type current_subset; ContainerT * mp_container; } ; Ex. If there is a vector container elements : [0,1,2,3,4]. An enumerated subset class of size 1, would have 5 different values of current vector of iterators, after which operator++ would return false. Those iterations the values would pointer to : [0],[1],[2],[3],[4] If this were created with subsets of size 2. It would be : [0,1],[0,2],[1,2],[0,3], [1,3],[2,3],[0,4],[1,4],[2,4],[3,4] If this were created with subsets of size 3. It would be: [0,1,2], [0,1,3], [0,2,3], [1,2,3], [0,1,4],[0,2,4],[0,3,4], [1,2,4], [1,3,4], [2,3,4] If you draw these out in a table with the pattern will become obvious to you ( I hope ). The sets closer to the beginning of the series are more tightly coupled to the lower iterators. The project also requires that you write a small program that uses this type to print out the above examples, and extend it for sets of size 3, 4, and 5. This must be platform independenct C++ code, only C++ standard headers and STL headers are allowed. In the example code please use iostream. ## Deliverables 1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done. 2) Deliverables must be in ready-to-run condition, as follows (depending on the nature of the deliverables): a) For web sites or other server-side deliverables intended to only ever exist in one place in the Buyer's environment--Deliverables must be installed by the Seller in ready-to-run condition in the Buyer's environment. b) For all others including desktop software or software the buyer intends to distribute: A software installation package that will install the software in ready-to-run condition on the platform(s) specified in this bid request. 3) All deliverables will be considered "work made for hire" under U.S. Copyright law. Buyer will receive exclusive and complete copyrights to all work purchased. (No GPL, GNU, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site per the coder's Seller Legal Agreement). ## Platform Platform independent, g++ compiled code that runs on a gcc 4.0 or greater release.
Project ID: 2951117

About the project

6 proposals
Remote project
Active 17 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
Awarded to:
User Avatar
See private message.
$42.50 USD in 4 days
4.9 (46 reviews)
4.6
4.6
6 freelancers are bidding on average $34 USD for this job
User Avatar
See private message.
$29.75 USD in 4 days
5.0 (73 reviews)
4.1
4.1
User Avatar
See private message.
$33.15 USD in 4 days
4.6 (7 reviews)
3.4
3.4
User Avatar
See private message.
$25.50 USD in 4 days
5.0 (8 reviews)
1.6
1.6
User Avatar
See private message.
$29.75 USD in 4 days
5.0 (3 reviews)
0.8
0.8
User Avatar
See private message.
$42.50 USD in 4 days
3.0 (1 review)
1.1
1.1

About the client

Flag of UNITED STATES
Mountain View, United States
5.0
6
Member since Oct 18, 2006

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.