- RefPtr
- Add more tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> // std::cout, std::endl; | |
#include <memory> // std::shared_ptr | |
#include <string> // std::string | |
#include <vector> // std::vector | |
class A | |
{ | |
public: | |
A() | |
{ |
Comparison of different calculations for Fibonacci numbers.
- Saving all the pair of function name and function pointer and using it to check and print its results
- e.g. Save a pair like ["Recursive", fibonacci_recursive]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// $ g++ dfs.cpp --std=c++11 | |
#include <iostream> | |
#include <vector> | |
template<class T> | |
void ShowResult(std::vector<T>& result) | |
{ | |
for (unsigned int i = 0 ; i < result.size() ; ++i) { | |
std::cout << result[i] << " "; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef BINARY_TREE_UTILS | |
#define BINARY_TREE_UTILS | |
#include <algorithm> // std::remove_if | |
#include <cstdlib> // std::calloc | |
#include <string> // std::string, std::stoi | |
#include <sstream> // std::istringstream | |
std::string nullStr = "#"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// $ g++ class-array.cpp --std=c++11 | |
#include <iostream> | |
class A | |
{ | |
public: | |
A() {} | |
~A() {} | |
void setValue(int v) { value = v; } | |
int getValue() { return value; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "BFM.h" | |
#include <assert.h> | |
BFM::BFM(Graph aGraph, unsigned int aStart) | |
: ShortestPath(aGraph, aStart) | |
, mNegativeCycleDetected(false) | |
{ | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if !defined(DISJOINTSET_H) | |
#define DISJOINTSET_H | |
// The disjoint-set/union–find/merge–find data structure: | |
// https://en.wikipedia.org/wiki/Disjoint-set_data_structure | |
class DisjointSet | |
{ | |
public: | |
// All numbers belong in different sets at the begining. | |
DisjointSet(unsigned int aNumbers) |