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 "MyVector.h" | |
template <typename T> | |
MyVector<T>::MyVector(void) | |
{ | |
_size = 0; | |
_cap = 2; | |
_vals = new T[_cap]; | |
} |
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
My sample codes are showing below | |
c++ vector data structure: | |
https://gist.github.com/zy66543/999ade0ac5cf57e16fab | |
sort a array (1 million data set, saving customers' ages, 0 to 130) | |
https://gist.github.com/zy66543/3861654a7adcdf37e081 |
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 "CountingSort.h" | |
CountingSort::CountingSort(void) | |
{ | |
} | |
CountingSort::CountingSort(int *original, int size) | |
{ | |
int cap = (int)DEF_RANGE; |
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 "AngBetHandM.h" | |
#include <stdlib.h> | |
AngBetHandM::AngBetHandM(void) | |
{ | |
} | |
AngBetHandM::~AngBetHandM(void) |
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
/////////////////////////////////////////////////////////////////////////// | |
// Function FindMin() // | |
// ver 1.0 // | |
// Type: cpp file // | |
// Language: C++ // | |
// Platform: Dell Alienware M14x, Win8 // | |
// Author: Yu Zhang, Syracuse University // | |
// yzhan39@syr.edu // | |
// Date: Feb 22, 2014 // | |
/////////////////////////////////////////////////////////////////////////// |
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
#pragma once | |
#include <cstdlib> | |
struct ISingleNode { | |
ISingleNode() {} | |
virtual ~ISingleNode() {} | |
virtual void setValue(int value) = 0; | |
virtual int getValue() = 0; | |
virtual ISingleNode * getNext() = 0; |
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 "DoubleList.h" | |
#include "DoubleNode.h" | |
#include "Interfaces01.h" | |
IDoubleNode * DoubleList::getHead() | |
{ | |
return _head; | |
} | |
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
/////////////////////////////////////////////////////////////////////////// | |
// TestString.cpp // | |
// ver 1.0 // | |
// Type: source file // | |
// Language: C++ // | |
// Platform: Dell Alienware M14x, Win8 // | |
// Author: Yu Zhang, Syracuse University // | |
// yzhan39@syr.edu // | |
// Description: http://www.yu-zhang.net/blog/2014/07/06/c-string/ // | |
/////////////////////////////////////////////////////////////////////////// |
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
/////////////////////////////////////////////////////////////////////////// | |
// UniqueString.cpp // | |
// ver 1.0 // | |
// Type: source file // | |
// Language: C++ // | |
// Platform: Dell Alienware M14x, Win8 // | |
// Author: Yu Zhang, Syracuse University // | |
// yzhan39@syr.edu // | |
// Description: http://www.yu-zhang.net/blog/2014/07/06/cci150c-unique-string // | |
/////////////////////////////////////////////////////////////////////////// |
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
/////////////////////////////////////////////////////////////////////////// | |
// ReverseString.cpp // | |
// ver 1.0 // | |
// Type: source file // | |
// Language: C++ // | |
// Platform: Dell Alienware M14x, Win8 // | |
// Author: Yu Zhang, Syracuse University // | |
// yzhan39@syr.edu // | |
// Description: http://www.yu-zhang.net/blog/2014/07/07/cci150c-reverse-string/// | |
/////////////////////////////////////////////////////////////////////////// |
OlderNewer