Wednesday, 27 February 2019

Fundamental Algorithms III

Three more fundamental algorithms in the series. Today, recursive permutations, subsets of the given set and variations with repetitions. The all written in C++ (non generic, I used std::vector). Code (hope it's self explanatory, any questions ask). 
Whole series.
Thank you.

33 comments:

nulleight said...

vector size() is not int! It is a size_t. This is a source of Bugs.

nulleight said...

printList should take a const vector<>& , it is expensive to copy.

nulleight said...

The same applies to other functions life for example "void recPermutation(vector s, vector r)"
You should use a reference instead of copying if you don't need a copy. Also use a const& if you can. You probably come from python and in python everything is a reference and copy is explicit, where in c/c++ everything is a copy and a reference has to be explicit.
Use for example: void recPermutation(vector const & s, vector const & r)
or void recPermutation(cont vector& s, const vector& r) which is the same to the line above.

lion137 said...

That's all true, thanks, I'm gonna edit the code.

Anonymous said...

Really a awesome blog for the freshers. Thanks for posting the information.
Digital Marketing Training in Delhi

Thermal paper company in bangalore said...


Your blog is has good info
We are magnum paper we are manufacturingthermal paper roll company in bangalore from past 4years .We are also thermal ribbon roll company in bangalore and also barcode label roll company in bangalore.

sociogramics said...

I really like reading through an article that will make men and women think. Also, thanks for allowing for me to comment!
Tech info

w3webschool said...

Great Article. Thank you for sharing! Really an awesome post for every one.
Digital Marketing Course In Kolkata

Anand Shankar said...

Awesome article, it was exceptionally helpful! I simply began in this and I'm becoming more acquainted with it better. The post is written in very a good manner and it contains many useful information for me. Thank you very much and will look for more postings from you.


digital marketing blog
digital marketing bloggers
digital marketing blogs
digital marketing blogs in india
digital marketing blog 2020
digital marketing blog sites
skartec's digital marketing blog
skartec's blog
digital marketing course
digital marketing course in chennai
digital marketing training
skartec digital marketing academy

Anonymous said...

prix greffe cheveux Tunisie
prix liposuccion Tunisie
Sleeve prix
Bypass prix
anneau gastrique tunisie

Anonymous said...

Chirurgie esthétique Tunisie
Chirurgie esthetique Tunisie
chirurgie esthétique tunisie

Unknown said...

Interesting
changement prothèses mammaires

Unknown said...

Thanks
abdominoplasty price

chirurgie esthétique nez said...

useful, nice!!

refaire son nez prix

Rajesh said...

It is actually a great and helpful piece of information about Java. I am satisfied that you simply shared this helpful information with us. Please stay us informed like this. Thanks for sharing.

Java training in chennai | Java training in annanagar | Java training in omr | Java training in porur | Java training in tambaram | Java training in velachery

Janu said...

Its a wonderful post and very helpful, thanks for all this information. You are including better information regarding this topic in an effective way. T hank you so much.


Dot Net Training in Chennai | Dot Net Training in anna nagar | Dot Net Training in omr | Dot Net Training in porur | Dot Net Training in tambaram | Dot Net Training in velachery










chirurgie esthétique nez said...

Interesting
chirurgie du nez

chirurgie esthetique seins said...

prothese mammaire

Unknown said...

Thanks
bypass

Tenride Cab Services said...

hyderabad to chennai cab
chennai to hyderabad cab
kochi to bangalore cab
bangalore to kochi cab
chennai to kochi cab

buy vyvanse online said...

What a good blog you have here on how to buy Vyvanse online medication. There are many order Vyvanse online
pharmacy websites that

Jobi said...

I am glad to be here and read your very interesting article, it was very informative and helpful information for me. keep it up.
deadpool shearling jacket

pawan said...

Interact Solutions bulk SMS service provider in India for business of all sizes and budget.
Voice call service provider in india
Email Marketing Services
Bulk SMS Agency
Bulk SMS Gateway

EMMANUEL said...

thank your for your thoughts

Python Training in chennai | Python Classes in Chennai

Rohit said...

It was reaaly wonderful reading your article. # BOOST Your GOOGLE RANKING.It’s Your Time To Be On #1st Page
Our Motive is not just to create links but to get them indexed as will
Increase Domain Authority (DA).We’re on a mission to increase DA PA of your domain
High Quality Backlink Building Service
1000 Backlink at cheapest
50 High Quality Backlinks for just 50 INR
2000 Backlink at cheapest
5000 Backlink at cheapest

andrewjackson said...

Our the purpose is to share the reviews about the latest Jackets,Coats and Vests also shre the related Movies,Gaming, Casual,Faux Leather and Leather materials available Standard Lakers Jacket

buy legit marijuana online said...

did you know buy weed online is the most trusted online dispensary. in addition, buy weed online legit offer weed at a cheap cost and
cheap ammo sell ammo online fast and really cheap

purebreedbulls said...

i have never been through such an amazing article like this. frosties-runtz-strain this so amazing keep up.

runtzshop said...

french bulldog have become the most wanted breed of dogs. everyone want to have this breed as their pet. french-bulldog-rescue-nc
available-french-bulldog thanks for giving me this opportunity to place a comment on your blog.

George Mark said...

I read this article. I think You put a lot of effort to create this article. I appreciate your work. Lindsay Weir Jacket

Alissa rose naer said...

Best dispensary in california
Legit online dispensary delivery worldwide

Website Development and Digital Marketing said...

We provide a full range of Website Development, SEO, e-commerce, Web Design, Mobile apps, Web Application, and Digital Marketing

Prix D’un Mini-Lifting said...

I read this article. I think You put a lot of effort to create this article. I appreciate your work

Prix D’un Lifting Visage
Prix D’un Lifting Seins