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
/*NOTE: IAM NOT A C++ PRO and THIS CODE CAN BE IMPROVED BY ALOT*/ | |
#include <iostream> | |
#include <fstream> | |
#include <iomanip> | |
#include <string> | |
#include <cstdio> | |
#include <stdio.h> | |
#include <stdlib.h> | |
using namespace std; |
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
/*CRTP -> Curiously recurring template pattern*/ | |
/* | |
CRTP is when a class A has a base class which is a template specialization for the class A itself. | |
eg: | |
template <class T> | |
class X{...}; | |
class A : public X<A> {...}; | |
(source: https://stackoverflow.com/questions/4173254/what-is-the-curiously-recurring-template-pattern-crtp) | |
*/ |
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> | |
using namespace std; | |
class Complex{ | |
private: | |
int real, imag; | |
public: | |
Complex(){ | |
real = 0; | |
imag = 0; |
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> | |
using namespace std; | |
class CircularQueue{ | |
private: | |
int front; | |
int rear; | |
int arr[5]; | |
int itemCount; | |
public: |
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> | |
using namespace std; | |
class Node { | |
public: | |
int data; | |
Node *next; | |
Node() { | |
data = 0; |
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> | |
using namespace std; | |
class Node { | |
public: | |
int coeff; | |
int power; | |
Node *next; | |
}; |
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
printSpace macro | |
mov dl, ' ' | |
mov ah, 2 | |
int 21h | |
endm | |
disp macro msg | |
mov cx, 12h | |
lea di, msg |
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> | |
using namespace std; | |
#define MAX 10 | |
void bubbleSort(int arr[]) { | |
for (int i = 0; i < MAX; i++) { | |
for (int j = 0; j < (MAX - i - 1); j++) { | |
if (arr[j] > arr[j + 1]) { | |
int temp = arr[j]; | |
arr[j] = arr[j + 1]; |
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> | |
using namespace std; | |
#define MAX 10 | |
void insertionSort(int arr[]) { | |
int key, j; | |
for (int i = 1; i < MAX; i++) { | |
key = arr[i]; | |
j = i - 1; |