diff -r 019f5c4964fc6470887519acf735664925626baf -r e1a05c29b2c476d9effe59f7832167d6a5aaf18d cpp/algorithms/src/Algorithm.h --- a/cpp/algorithms/src/Algorithm.h Sat Feb 16 17:51:39 2013 -0600 +++ b/cpp/algorithms/src/Algorithm.h Sat Feb 16 18:34:29 2013 -0600 @@ -10,6 +10,7 @@ { protected: std::vector _container; + //friend class SortAlgorithm; public: void initContainer(std::vector arr) { diff -r 019f5c4964fc6470887519acf735664925626baf -r e1a05c29b2c476d9effe59f7832167d6a5aaf18d cpp/algorithms/src/InsertSort.h --- a/cpp/algorithms/src/InsertSort.h Sat Feb 16 17:51:39 2013 -0600 +++ b/cpp/algorithms/src/InsertSort.h Sat Feb 16 18:34:29 2013 -0600 @@ -4,11 +4,25 @@ #include "SortAlgorithm.h" template -class InsertSort : public SortAlgorithm +class InsertSort : public SortAlgorithm, public Algorithm { +public: virtual void Sort() { - + int x; + T currelement; + for(size_t i = 1; i < this->_container.size(); i++) + { + x = i - 1; + currelement = this->_container[i]; + while(x >= 0 && _container[x] > currelement) + { + _container[x+1] = _container[x]; + x = x - 1; + + } + _container[x + 1] = currelement; + } } }; diff -r 019f5c4964fc6470887519acf735664925626baf -r e1a05c29b2c476d9effe59f7832167d6a5aaf18d cpp/algorithms/src/SearchAlgorithm.h --- a/cpp/algorithms/src/SearchAlgorithm.h Sat Feb 16 17:51:39 2013 -0600 +++ b/cpp/algorithms/src/SearchAlgorithm.h Sat Feb 16 18:34:29 2013 -0600 @@ -3,10 +3,10 @@ #include "Algorithm.h" -template -class SearchAlgorithm : public Algorithm +class SearchAlgorithm { public: + //void f() { this-> virtual void Search() = 0; }; diff -r 019f5c4964fc6470887519acf735664925626baf -r e1a05c29b2c476d9effe59f7832167d6a5aaf18d cpp/algorithms/src/SortAlgorithm.h --- a/cpp/algorithms/src/SortAlgorithm.h Sat Feb 16 17:51:39 2013 -0600 +++ b/cpp/algorithms/src/SortAlgorithm.h Sat Feb 16 18:34:29 2013 -0600 @@ -3,8 +3,8 @@ #include "Algorithm.h" -template -class SortAlgorithm : public Algorithm + +class SortAlgorithm { public: virtual void Sort() = 0; diff -r 019f5c4964fc6470887519acf735664925626baf -r e1a05c29b2c476d9effe59f7832167d6a5aaf18d cpp/algorithms/src/main.cpp --- a/cpp/algorithms/src/main.cpp Sat Feb 16 17:51:39 2013 -0600 +++ b/cpp/algorithms/src/main.cpp Sat Feb 16 18:34:29 2013 -0600 @@ -3,13 +3,17 @@ #include "vector_helper.h" #include +#include + using namespace std; int main() { InsertSort sort1; + //sort1.initContainer(create_vector("test")("test2")); //cout << sort1.ToString(); //vector arr1 = create_vector( - sort1.initContainer(create_vector(1)(2)(3)); + sort1.initContainer(create_vector(3)(2)(3)); + sort1.Sort(); cout << sort1.ToString() << endl; } \ No newline at end of file