Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Christophe Wang christophewang

🎯
Focusing
Block or report user

Report or block christophewang

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@christophewang
christophewang / MergeSort.cpp
Last active Jun 18, 2019
Merge Sort in C++
View MergeSort.cpp
#include <iostream>
void printArray(int *array, int n)
{
for (int i = 0; i < n; ++i)
std::cout << array[i] << std::endl;
}
void merge(int *array, int low, int mid, int high)
{
@christophewang
christophewang / QuickSort.cpp
Last active Oct 14, 2019
Quick Sort in C++
View QuickSort.cpp
#include <iostream>
void printArray(int *array, int n)
{
for (int i = 0; i < n; ++i)
std::cout << array[i] << std::endl;
}
void quickSort(int *array, int low, int high)
{
@christophewang
christophewang / InsertionSort.cpp
Last active Apr 15, 2019
Insertion Sort in C++
View InsertionSort.cpp
#include <iostream>
void printArray(int *array, int n)
{
for (int i = 0; i < n; ++i)
std::cout << array[i] << std::endl;
}
void insertionSort(int *array, int n)
{
@christophewang
christophewang / SelectionSort.cpp
Last active Aug 29, 2015
Selection Sort in C++
View SelectionSort.cpp
#include <iostream>
void printArray(int *array, int n)
{
for (int i = 0; i < n; ++i)
std::cout << array[i] << std::endl;
}
void selectionSort(int *array, int n)
{
@christophewang
christophewang / BubbleSort.cpp
Last active Apr 15, 2019
Bubble Sort in C++
View BubbleSort.cpp
#include <iostream>
void printArray(int *array, int n)
{
for (int i = 0; i < n; ++i)
std::cout << array[i] << std::endl;
}
void bubbleSort(int *array, int n)
{
@christophewang
christophewang / BinarySearch.cpp
Last active Apr 15, 2019
Binary Search in C++
View BinarySearch.cpp
#include <iostream>
/* Binary Search */
int binarySearch(int *array, int n, int target)
{
int low = 0;
int high = n - 1;
while (low <= high)
{
@christophewang
christophewang / BinarySearchTree.cpp
Last active Apr 15, 2019
Binary Search Tree in C++
View BinarySearchTree.cpp
#include <iostream>
/* Node Structure */
struct BstNode
{
int data;
BstNode *left;
BstNode *right;
};
You can’t perform that action at this time.