[pt_view id="6491efea00"]
Continue ReadingC++: Binary Search Tree Verification
struct TreeNode { int data; TreeNode *left; TreeNode *right; }; bool isBST(TreeNode *node, int minData, int maxData) { if(node == NULL
Continue ReadingC++: Split a string in C++
What’s the most elegant way to split a string in C++? The string can be assumed to be composed of words separated by whitespace. (Note that I’m
Continue ReadingC++: Longest Common Subsequence
#include <algorithm> #include <string> #include <vector> #include <stdio.h> #include <string.h> // See http
Continue ReadingWhy doesn’t GCC optimize a*a*a*a*a*a to (a*a*a)*(a*a*a)?
I am doing some numerical optimization on a scientific application. One thing I noticed is that GCC will optimize the call pow(a,2) by compiling it in
Continue ReadingC++: Bubble Sort
#include <algorithm> template<typename Iterator> void bubbleSort(Iterator first, Iterator last) { Iterator i, j; for (i = fir
Continue ReadingC++: Merge Sort
#include <iostream> using namespace std; void merge(int a[], const int low, const int mid, const int high) { // Variables declarati
Continue ReadingRead/convert an InputStream to a String
If you have java.io.InputStream object, how should you process that object and produce a String? Suppose I have an InputStream that contains te
Continue ReadingC++ String Algorithms
[pt_view id="ce50e34ece"]
Continue ReadingC++ Sorts
[pt_view id="cd7c62717a"]
Continue Reading




