Skip to content

Instantly share code, notes, and snippets.

View shivajichalise's full-sized avatar
:shipit:
tryin' to be something, one line at a time

Shivaji Chalise shivajichalise

:shipit:
tryin' to be something, one line at a time
View GitHub Profile
@shivajichalise
shivajichalise / insertionsort.cpp
Created March 23, 2022 04:51
Insertion Sort implementation in C++
#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;
@shivajichalise
shivajichalise / bubblesort.cpp
Created March 23, 2022 03:24
Bubble Sort implementation in C++
#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];
@shivajichalise
shivajichalise / pu.asm
Created February 15, 2022 03:49
Assembly language program to display a string 'POKHARA UNIVERSITY' character wise using macro to insert space between characters.
printSpace macro
mov dl, ' '
mov ah, 2
int 21h
endm
disp macro msg
mov cx, 12h
lea di, msg
@shivajichalise
shivajichalise / addTwoPolynomials.cpp
Last active January 27, 2022 08:04
Add two polynomials using linked list in C++
#include <iostream>
using namespace std;
class Node {
public:
int coeff;
int power;
Node *next;
};
@shivajichalise
shivajichalise / connect-linux-ethernet-lan-ssh.md
Created January 24, 2022 11:36 — forked from atweiden/connect-linux-ethernet-lan-ssh.md
directly connect two linux machines using an ethernet cable

ssh/rsync from one Linux machine to another with a standard ethernet cable

Overview

  • Install ifplugd and openssh on both machines.
  • Optionally install inxi on both machines (recommended).
@shivajichalise
shivajichalise / singlyLinkedList.cpp
Last active March 22, 2022 15:08
Singly Linked List implementation in C++
#include <iostream>
using namespace std;
class Node {
public:
int data;
Node *next;
Node() {
data = 0;
@shivajichalise
shivajichalise / circularQueue.cpp
Created December 10, 2021 00:03
Implementing Queue in C++
#include <iostream>
using namespace std;
class CircularQueue{
private:
int front;
int rear;
int arr[5];
int itemCount;
public:
@shivajichalise
shivajichalise / cpp--binary-operator-overloading.cpp
Last active July 28, 2021 02:51
Operator Overloading in C++
#include <iostream>
using namespace std;
class Complex{
private:
int real, imag;
public:
Complex(){
real = 0;
imag = 0;
/*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)
*/
@shivajichalise
shivajichalise / cpp-file-handling-and-crud.cpp
Last active July 26, 2021 07:27
C++ File handling && CRUD program
/*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;