This file contains 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 <iostream> | |
/* Node Structure */ | |
struct BstNode | |
{ | |
int data; | |
BstNode *left; | |
BstNode *right; | |
}; |
This file contains 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 <iostream> | |
/* Binary Search */ | |
int binarySearch(int *array, int n, int target) | |
{ | |
int low = 0; | |
int high = n - 1; | |
while (low <= high) | |
{ |
This file contains 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 <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) | |
{ |
This file contains 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 <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) | |
{ |
This file contains 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 <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) | |
{ |
This file contains 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 <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) | |
{ |
This file contains 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 <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) | |
{ |