Skip to content

Instantly share code, notes, and snippets.

View thinkphp's full-sized avatar
💭
If I have seen further it is only by standing on the shoulders of giants. Newton

Adrian Statescu thinkphp

💭
If I have seen further it is only by standing on the shoulders of giants. Newton
View GitHub Profile
@thinkphp
thinkphp / gist:d716c6edc26b05e786a39062d09e76ec
Created November 30, 2026 10:10
Arbore Binar - diametrul si adancime maxima.
#include <stdio.h>
#include <stdlib.h>
typedef struct node_type {
int id;
struct node_type *left,
*right;
} NodeT;
@thinkphp
thinkphp / bst-basic.c
Created November 30, 2026 09:38
Arbore Binar de Cautare : bst-basic.c
#include <stdio.h>
#include <stdlib.h>
typedef struct _TREE_NODE {
int key;
struct _TREE_NODE *left;
struct _TREE_NODE *right;
@thinkphp
thinkphp / combinari.c
Created November 30, 2026 08:14
Combinari Backtracking
#include <stdio.h>
#define SIZE 100
int n, k,
sol[ SIZE ];
// p = 2
void comb(int p) {
@thinkphp
thinkphp / BKT-recursive.c
Created November 30, 2026 07:52
Backtracking - varianta recursiva
/*
n = 3
3! = 1 * 2 * 3 = 6 permutari
Stiva 3 elemente
1 2 3 -prima solutie
1 3 2 -a doua solutie
@thinkphp
thinkphp / bkt-iterativ.c
Created November 30, 2026 07:51
Backtracking - varianta nerecursiva
/*
n = 3
3! = 1 * 2 * 3 = 6 permutari
Stiva 3 elemente
1 2 3 -prima solutie
1 3 2 -a doua solutie
@thinkphp
thinkphp / televizor.cpp
Created November 25, 2026 13:53
televizor.cpp
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
enum class TipEcran {
LED, OLED
};
@thinkphp
thinkphp / file-binary.cpp
Created November 25, 2026 12:49
Citire/SCriere in fisier binar
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main(int argc, char const *argv[]) {
int varsta = 20;
float inaltime = 1.82f;
#include <iostream>
using namespace std;
double imparte(double a, double b) {
if(b == 0) {
throw runtime_error("Nu se poate imparti la zero!"); //aruncam eroarea
}
@thinkphp
thinkphp / parcurgere-iterativ-in-preordine.c
Created November 16, 2026 09:55
Arbore binar cu parcurgere in preordine iterativ
#include <stdio.h>
#include <stdlib.h>
typedef struct node_type {
int id;
struct node_type *left,
*right;
@thinkphp
thinkphp / swapChildren.c
Created November 16, 2026 09:40
Arbore binar Schimbare Swap Children
#include <stdio.h>
#include <stdlib.h>
typedef struct node_type {
int id;
struct node_type *left,
*right;