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 / HexSHA512.class.php
Last active October 3, 2022 09:09
Hash & Verify - sha512 & hex.. php
final class HexSHA512 {
public static final function Hash($s) {
return (bin2hex(hash('sha512', $s.bin2hex($s), true)));
}
public static final function Verify($s, $h) {
return (HexSHA512::Hash($s) == $h);
}
}
$s = "hello there";
@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 / linkedlist_s_stu.cpp
Created April 25, 2020 14:06
Simple Single Linked List with Student Class Implementation in C++
#include <iostream>
#include <string>
using namespace std;
#define null 0
class Student {
public:
string name;
int age;
float gpa;
@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 / bst.cpp
Last active November 9, 2020 02:08
Some Sorts 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] << ", ";
}