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
<!DOCTYPE html>
<html>
<head>
<title>W3.CSS Template</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Raleway">
<style>
body,h1 {font-family: "Raleway", sans-serif}
@thinkphp
thinkphp / stack-teorie.md
Last active January 20, 2025 15:19
Stack Data Structure Teorie

O stiva functionează pe principiul LIFO (Last In First Out) - ultimul element adăugat este primul care iese. Gandeste-te la o stiva de obiecte - poti adăuga sau lua doar de sus.

#define MAX_SIZE 100

// Structura stivei
typedef struct {
    int array[MAX_SIZE];  // Array-ul care stocheaza elementele
    int top;             // Indexul varfului stivei
} Stack;
@thinkphp
thinkphp / vector-n-dimensional.asm
Created January 19, 2025 03:38
Fragment de program: determina valoarea absoluta intreaga |v| = sqrt(v1^2 + v2^2 + ... + v3^2) a unui vector V intr-un spatiu n-dimensional. Respecta conventiile IA-32
section .data
prompt_n db "Vector intr-un spatiul n-dimensional (n): ", 0
prompt_num db "Enter number %d: ", 10, 0
result_msg db "Sum of squares is: %ld", 10, 0
sqrt_msg db "Square root of sum is: %lf", 10, 0
fmt_int db "%ld%*c", 0
section .bss
n resq 1
current_num resq 1
@thinkphp
thinkphp / Exercitiul7punctulc).asm
Created January 19, 2025 03:29
Exercitiul 7 punctul c) Pipeline IF ID LD EX WB
Folosind timpul pipiline de 130 ps determinat anterior.
Instrucțiunile sunt:
- ADD R3, R2, R1 (R3 ← R2 + R1)
- SUB R4, R1, R3 (R4 ← R1 - R3)
Identificarea dependenței:
Avem o dependență de tip RAW (Read After Write) deoarece:
- Prima instrucțiune (ADD) scrie în R3
- A doua instructiune (SUB) citește R3
@thinkphp
thinkphp / coeficient-binomial.asm
Created January 16, 2025 11:14
Coeficient binomial (n,k)
section .data
n dd 5 ; n = 5
k dd 2 ; k = 2
section .text
global _start
_start:
mov eax, 1 ;
mov ecx, 1 ;
@thinkphp
thinkphp / maxabs.asm
Created January 16, 2025 10:34
Cauta valoarea maxima absoluta intr-un vector
section .data
vec DD -5, -7, 3, -17, 8, -2, 0 ; vector exemplu
section .text
global _start
_start:
xor ebx, ebx ; ebx = 0 (maxim curent)
mov esi, vec ; esi = adresa vectorrului
@thinkphp
thinkphp / mean.asm
Created January 16, 2025 10:10
Media Aritmetica 8 numere pornind de la adresa simbolica werte
section .data
; aici definim cele 8 numere pornind de la adresa simbolica WERTE
werte dd 10, 20, 30, 40, 50, 60, 70, 80 ; poti sa schimbi numerele, nu este nicio problema.
count equ 8 ;stabilim numarul de numere in count
section .text
global _start
_start:
mov eax, 0 ; initializam suma cu 0
@thinkphp
thinkphp / append-liste.c
Created January 7, 2025 19:55
concatenare liste
#include <stdio.h>
#include <stdlib.h>
#define EXIT_SUCCESS 0
typedef struct node {
int data;
struct node* next;
} node_t;
//functie de afisare a listei simplu inlantuite
@thinkphp
thinkphp / rating.html
Created December 7, 2024 13:18
rating
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
* {
box-sizing: border-box;
transition: all 0.3s ease;
@thinkphp
thinkphp / suma2.txt
Created November 26, 2024 09:15
Problema Suma2 - rewrite - sume partiale
Problema Suma2
--------------
Fie N un numar natural si un sir de N numere naturale V[1], V[2],...,V[N]. Pentru M intrebari de forma (i,j), sa se calculeze media geometrica(aritmetica) a termenilor V[i], V[i+1],...,V[j].
Input:
Date de intrare
Pe prima linie a fișierului medii.in se găsește un număr natural N.
Pe următoarea linie se află N numere naturale, reprezentând valorile șirului V.
Pe a treia linie se află un număr natural M, reprezentând numărul de întrebări.
Pe următoarele M linii se află câte o pereche de numere (i,j) reprezentând o întrebare
pentru care se cere să se calculeze media geometrică(aritmetica) a termenilor V[i], V[i+1],...,V[j].