waqqasfarooq.com

  • Increase font size
  • Default font size
  • Decrease font size
Greetings from Waqqas!


Getting random element from std collection

E-mail Print PDF

The following code snippet gives a quick way of selecting an element at random from a std collection.

 

Remove elements from std::map and std::set

E-mail Print PDF

Often times we are faced with the situation of iterating through a std::map or std::set and remove elements as we are iterating through the collection. Following is a way to remove elements from the collection without invalidating the iterator:

 

String replace in c++

E-mail Print PDF

Code to replace a substring in a string.


 

Monte Carlo Method

E-mail Print PDF

To explain Monte Carlo simulation method, I’ll give a quick introduction/motivation of monte-carlo method, then I’ll walk through an example. I will give details the technical concepts as per need, i.e. I won’t just list down definitions/explanations all at once and then use them in an example.


 


Page 3 of 3