This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <vector> | |
| #include <algorithm> | |
| using namespace std; | |
| // template<typename T> spune compilatorului T este un tip necunoscut, il deduci din apel | |
| template<typename T> | |
| T maxim(T a,T b) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <cmath> | |
| using namespace std; | |
| class Vector2D { | |
| public: | |
| double x, y; | |
| Vector2D(double x=0, double y=0): x(x),y(y) {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <numeric> //pentru a utiliza GCD | |
| using namespace std; | |
| class Fractie { | |
| int nr, nm;//date membre private | |
| void simplifica() { //metoda privata |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Cei 4 piloni fundamentali: | |
| - incapsulare - datele si metodele sunt grupate impreuna,iar detaliile interne sunt ascunse fata de exterior. | |
| - Mostenire - o clasa poate prelua atributele si comportamentele altei clasei, evitand duplicarea coduliu | |
| - Polimorfism - acelasi APEL de metoda poate produce comportamente diferite in functie de tipul real al obiectului | |
| - Abstractizare - complexitatea este ascunsa in spatele unor interfete simple. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <vector> | |
| using namespace std; | |
| class Angajat { | |
| protected: | |
| string nume; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| using namespace std; | |
| int isPrime(int n) { | |
| int i = 2; | |
| int prime = 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*Teorema fundamentala a aritmeticii | |
| orice numar poate sa fie descompus in produs de factori primi | |
| 10 = 2^1 * 5^1 | |
| 11 = 11^1 | |
| 12 = 2^2 * 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Greedy | |
| ------ | |
| Se considera o multime A. Se cere o submultime a sa astfel incat sa fie indeplinite anumite conditii (acestea difera de la o problema la alta). | |
| Structura generala a unei aplicatii Greedy este data mai jos: | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Divide Et Impera: | |
| Prezentare generala: | |
| -------------------------------------- | |
| Este o tehnica speciala prin care se pot rezolva anumite probleme: | |
| Divide et impera se bazeaza pe un principiu extrem de simplu: | |
| - descompunem problema in doua sau mai multe subprobleme (mai usoare) | |
| care se rezolva, iar solutia pentru problema initiala se obtine combinand solutiile problemelor in care a fost descompusa problema intiala |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| using namespace std; | |
| int v[100]; | |
| // 1 5 | |
| /* | |
| n=5 | |
| 10 101 90 23 44 |
NewerOlder