Skip to content

Instantly share code, notes, and snippets.

View kingsamchen's full-sized avatar
🐛
Work life balance

0xCCCCCCCC kingsamchen

🐛
Work life balance
View GitHub Profile
@kingsamchen
kingsamchen / _vimrc
Created March 3, 2013 08:26
My _vimrc
if(has("win32") || has("win95") || has("win64") || has("win16"))
let g:vimrc_iswindows=1
let g:iswindows=1
else
let g:vimrc_iswindows=0
let g:iswindows=0
endif
autocmd BufEnter * lcd %:p:h
set nocompatible
@kingsamchen
kingsamchen / qsort_partition_twoversions.cpp
Last active December 16, 2015 03:39
two usual versions of implementations
int Partition(int a[], int left, int right)
{
int piv = a[left];
int l = left, r = right + 1;
do
{
do
{
++l;
@kingsamchen
kingsamchen / type_traits_demo.cpp
Last active December 16, 2015 12:09
demo for traits implementation
struct built_in_type_tag{};
struct integer_type_tag : public built_in_type_tag {};
struct user_defined_type_tag{};
template<typename TypeT>
struct type_traits
{
typedef typename TypeT::type_category type_category;
};
template<typename T>
class NewHandlerSupport
{
public:
static std::new_handler set_new_handler(std::new_handler p) throw();
static void* operator new(std::size_t size) throw(std::bad_alloc);
...
private:
static std::new_handler currentHandler;
};
@kingsamchen
kingsamchen / ichar_traits.cpp
Created May 14, 2013 03:16
user_defined stl::basic_string traits
using std::basic_string;
using std::char_traits;
using std::string;
using std::toupper;;
struct ichar_traits : char_traits<char>
{
static bool eq(const char& _Left, const char& _Right)
{
return toupper(_Left) == toupper(_Right);
#include <cassert>
#include <cstdio>
#define PARENT(x) (((x) - 1) >> 1)
#define LEFTCHILD(x) (((x) << 1) + 1)
#define RIGHTCHILD(x) (((x) + 1) << 1)
template<typename T>
class CPriQueue
{
class NLComponent
{
public:
virtual NLComponent* clone() const = 0;
};
class TextBlocks : public NLComponent
{
public:
// only a single object allowed
struct PrintJob
{
PrintJob(const string& name) : Name(name)
{
}
string Name;
};
class Printer

original tabu Search

  1. determine the next move
  2. add the move into tabu list with a specified tabu iteration count in order to avoid cycling.
  3. aspiration strategy allowed if a move, despite in tabu, generates a better result than ever been.

robust tabu search

I. (seemingly) slight differences in general tactics

//// C#
class SeqTest
{
string _inClassName;
public string InClassName
{
get {return _inClassName;}
set {_inClassName = value;}