This file contains 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 Heap: | |
def __init__(self, key, arr=[]) -> None: | |
self.arr = arr | |
self.key = key | |
def add(self, element) -> None: | |
self.arr.append(element) | |
self.heapify_up() | |
def pop(self): |
This file contains 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> | |
#include <iostream> | |
typedef std::unordered_map<int, std::vector<int>> mapiv; | |
typedef std::vector<std::vector<int>> vvi; | |
typedef std::vector<int> vi; | |
typedef std::vector<bool> vb; | |
using namespace std; | |
void dfs1(int node, vb &seen, mapiv &adjacency, vi &stack) |