Skip to content

Instantly share code, notes, and snippets.

View m-primo's full-sized avatar
🤡

Primo m-primo

🤡
View GitHub Profile
@m-primo
m-primo / queue.cpp
Created April 25, 2020 14:02
Simple Queue Implementation in c++
#include <iostream>
using namespace std;
#define null 0
class QueueArray {
private:
int front;
int rear;
int numOfEl;
int size;
@m-primo
m-primo / stack.cpp
Created April 25, 2020 14:03
Simple Stack Implementation in C++
#include <iostream>
using namespace std;
#define null 0
class StackArray {
private:
int size;
int *stackArr;
int top;
void resize() {
@m-primo
m-primo / linkedlist_d.cpp
Created April 25, 2020 14:04
Simple Double Linked List Implementation in C++
#include <iostream>
using namespace std;
#define null 0
class Node {
public:
int data;
Node *next;
Node *prev;
Node(int data) {
@m-primo
m-primo / linkedlist_s.cpp
Created April 25, 2020 14:05
Simple Single Linked List Implementation in C++
#include <iostream>
using namespace std;
#define null 0
class Node {
public:
int data;
Node *next;
Node(int data) {
this->data = data;
@m-primo
m-primo / linear_binary_jump_interpolation__search.cpp
Created April 25, 2020 14:08
Simple Linear, Binary, Jump & Interpolation Search Implementation in C++
void swap(int &a, int &b) {
int temp = a;
a = b;
b = temp;
}
void showArray(int arr[], int size) {
for(int i = 0; i < size; i++) {
cout << arr[i] << ", ";
}
@m-primo
m-primo / bubble_selection_insertion_count__sort
Created April 25, 2020 14:10
Simple Bubble, Selection, Insertion & Count Sort Implementation in C++
void swap(int &a, int &b) {
int temp = a;
a = b;
b = temp;
}
void showArray(int arr[], int size) {
for(int i = 0; i < size; i++) {
cout << arr[i] << ", ";
}
@m-primo
m-primo / heap.cpp
Created April 25, 2020 14:12
Simple Heap Implementation in C++
void swap(int &a, int &b) {
int temp = a;
a = b;
b = temp;
}
void showArray(int arr[], int size) {
for(int i = 0; i < size; i++) {
cout << arr[i] << ", ";
}
@m-primo
m-primo / ascii.cpp
Created April 25, 2020 14:42
Ascii Codes in C++
#include <iostream>
#include <conio.h>
using namespace std;
int main() {
char key_press;
int ascii_value;
cout<<"\n\t\t\tPress Any Key To Check Its ASCII Code\n\n\t\t\tPress ESC to EXIT\n\n\n";
while(1) {
key_press = getch();
@m-primo
m-primo / pascal_tri.cpp
Created April 25, 2020 14:43
pascal triangle c++
#include <iostream>
using namespace std;
int a, b;
int main() {
cout << "A: ";
cin >> a;
cout << 1 << " " << endl;
for(int i = 0; i <= a; i++) {
@m-primo
m-primo / largest_so_far.cpp
Created April 25, 2020 14:43
find the largest value in c++
#include "stdafx.h"
#include <iostream>
using namespace std;
int main() {
int itemValue;
int largestSoFar;
int minValue;