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
| import java.io.*; | |
| import java.util.*; | |
| class GraphAdjMatrix { | |
| private int[][] mat; | |
| private boolean[] vizitat; | |
| private int n; | |
| public GraphAdjMatrix(int n) { |
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
| public class DoublyLinkedList { | |
| static class Node { | |
| int data; | |
| Node next; | |
| Node prev; | |
| Node(int data) { | |
| this.data = data; |
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
| /* | |
| LRU Cache capacitate 5 | |
| MostRecently U Least Recenty Used | |
| HEAD(-1) 9 <-> 10 <-> 1 <-> 5 <-> 2(-1)TAIL | |
| Put(5) | |
| get(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
| https://web.stanford.edu/class/cs97si/06-basic-graph-algorithms.pdf | |
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 <stdio.h> | |
| #define MAX 105 | |
| #define FIN "royfloyd.in" | |
| #define FOUT "royfloyd.out" | |
| //function prototypes | |
| void read(); | |
| void RoyFloyd(); | |
| void write(); |
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 <bits/stdc++.h> | |
| #define FIN "cautbin.in" | |
| #define FOUT "cautbin.out" | |
| using namespace std; | |
| //returns the largest index such that arr[i] == key | |
| // or -1 whether the key is not in the array | |
| int binary_search0(int *arr, int lo, int hi, int key) { | |
| if(lo > hi) { |
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 <unordered_map> | |
| /* | |
| capacity = 5 | |
| Head 11 8 5 1 4 Tail | |
| tail->prev inseamna nodul cu key 7 | |
| head->next = inseamna nodul cu key 8 |
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
| //BFS > graful este reprezentat prin matricea de adiacenta | |
| #include <iostream> | |
| #include <queue> | |
| #include <vector> | |
| using namespace std; | |
| class GrafMatrice { | |
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 <queue> | |
| using namespace std; | |
| struct Node { | |
| int vecin; | |
| Node*urmator; | |
| Node(int vecin): vecin(vecin), urmator(nullptr) {} |
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
| class Solution { | |
| public: | |
| vector<int> twoSum(vector<int> &nums, int target) { | |
| map<int,int> mp; | |
| int n = num.size(); |