Skip to content

Instantly share code, notes, and snippets.

@eazybit
eazybit / RobotMove.cpp
Last active August 29, 2015 14:04
[C++] - Possible ways to move from top-left to bottom-right of a M*N chess board. You can only move to the right or bottom at each time.
///////////////////////////////////////////////////////////////////////////
// RobotMove.cpp //
// ver 1.0 //
// Type: source file //
// Language: C++ //
// Platform: Dell Alienware M14x, Win8 //
// Author: Yu Zhang, Syracuse University //
// zyu.1106@gmail.com //
// yzhan39@syr.edu //
// Description: http://www.yu-zhang.net/blog/2014/07/21/c-possible-ways-to-move-from-top-left-to-bottom-right-of-a-mn-chess-board-you-can-only-move-to-the-right-or-bottom-at-each-time///
@eazybit
eazybit / HopStairs.cpp
Last active August 29, 2015 14:04
[C++] - You can hop either 1, 2, or 3 steps at a time. Implement a method to count how many possible ways to run up the stairs with n steps.
///////////////////////////////////////////////////////////////////////////
// HopStairs.cpp //
// ver 1.0 //
// Type: source file //
// Language: C++ //
// Platform: Dell Alienware M14x, Win8 //
// Author: Yu Zhang, Syracuse University //
// zyu.1106@gmail.com //
// yzhan39@syr.edu //
// Description: http://www.yu-zhang.net/blog/2014/07/21/cci150-recursion-c-you-can-hop-either-1-2-or-3-steps-at-a-time-implement-a-method-to-count-how-many-possible-ways-to-run-up-the-stairs-with-n-steps///
@eazybit
eazybit / BinaryOfDouble.cpp
Last active August 29, 2015 14:04
[C++] - Binary representation (string format) of a double number
///////////////////////////////////////////////////////////////////////////
// BinaryOfDouble.cpp //
// ver 1.0 //
// Type: source file //
// Language: C++ //
// Platform: Dell Alienware M14x, Win8 //
// Author: Yu Zhang, Syracuse University //
// zyu.1106@gmail.com //
// yzhan39@syr.edu //
// Description: http://www.yu-zhang.net/blog/2014/07/18/cci150-c-binary-representation-of-a-double-number///
@eazybit
eazybit / MergeSort.cpp
Last active August 29, 2015 14:04
[C++] - Merge Sort
///////////////////////////////////////////////////////////////////////////
// MergeSort.cpp //
// ver 1.0 //
// Type: source file //
// Language: C++ //
// Platform: Dell Alienware M14x, Win8 //
// Author: Yu Zhang, Syracuse University //
// zyu.1106@gmail.com //
// yzhan39@syr.edu //
// Description: http://www.yu-zhang.net/blog/2014/07/18/c-merge-sort///
@eazybit
eazybit / InsertNumber.cpp
Last active August 29, 2015 14:04
[C++] - Insert a number M into a number N at position i to j
///////////////////////////////////////////////////////////////////////////
// InsertNumber.cpp //
// ver 1.0 //
// Type: source file //
// Language: C++ //
// Platform: Dell Alienware M14x, Win8 //
// Author: Yu Zhang, Syracuse University //
// zyu.1106@gmail.com //
// yzhan39@syr.edu //
// Description: http://www.yu-zhang.net/blog/2014/07/17/cci150-bit-manipulation-c-insert-a-number-m-into-a-number-n-at-position-i-to-j///
@eazybit
eazybit / TestRoute.cpp
Last active August 29, 2015 14:04
[C++] - Find out whether there is a route between two vertices in a graph
///////////////////////////////////////////////////////////////////////////
// TestRoute.cpp //
// ver 1.0 //
// Type: source file //
// Language: C++ //
// Platform: Dell Alienware M14x, Win8 //
// Author: Yu Zhang, Syracuse University //
// zyu.1106@gmail.com //
// yzhan39@syr.edu //
// Description: http://www.yu-zhang.net/blog/2014/07/16/cci150-c-find-out-whether-there-is-a-route-between-two-nodes///
@eazybit
eazybit / Shelter.cpp
Last active August 29, 2015 14:03
[C++] - Polymorphism Shelter
///////////////////////////////////////////////////////////////////////////
// Shelter.cpp //
// ver 1.0 //
// Type: ource file //
// Language: C++ //
// Platform: Dell Alienware M14x, Win8 //
// Author: Yu Zhang, Syracuse University //
// zyu.1106@gmail.com //
// yzhan39@syr.edu //
// Description: http://www.yu-zhang.net/blog/2014/07/13/cci150-c-ploymorphism-shelter///
@eazybit
eazybit / SortStack.cpp
Last active August 29, 2015 14:03
[C++] - Sort a stack with another stack
///////////////////////////////////////////////////////////////////////////
// SortStack.cpp //
// ver 1.0 //
// Type: source file //
// Language: C++ //
// Platform: Dell Alienware M14x, Win8 //
// Author: Yu Zhang, Syracuse University //
// zyu.1106@gmail.com //
// yzhan39@syr.edu //
// Description: http://www.yu-zhang.net/blog/2014/07/13/cci150-c-sort-a-stack-with-another-stack///
@eazybit
eazybit / MyQueue.cpp
Last active August 29, 2015 14:03
[C++] - Implement a MyQueue class using only two stacks.
///////////////////////////////////////////////////////////////////////////
// MyQueue.cpp //
// ver 1.0 //
// Type: source file //
// Language: C++ //
// Platform: Dell Alienware M14x, Win8 //
// Author: Yu Zhang, Syracuse University //
// zyu.1106@gmail.com //
// yzhan39@syr.edu //
// Description: http://www.yu-zhang.net/blog/2014/07/13/cci150-c-implement-a-myqueue-class-which-implements-a-queue-using-two-stacks///
@eazybit
eazybit / Hanoi.cpp
Last active August 29, 2015 14:03
[C++] - Towers of Hanoi
///////////////////////////////////////////////////////////////////////////
// Hanoi.cpp //
// ver 1.0 //
// Type: source file //
// Language: C++ //
// Platform: Dell Alienware M14x, Win8 //
// Author: Yu Zhang, Syracuse University //
// zyu.1106@gmail.com //
// yzhan39@syr.edu //
// Description: http://www.yu-zhang.net/blog/2014/07/13/cci150-c-towers-of-hanoi///