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 <iostream> | |
#include <stdexcept> | |
struct Node { | |
int data; | |
Node* next; | |
}; | |
class Queue { | |
private: |
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 <iostream> | |
#include <stdexcept> | |
class Queue { | |
private: | |
int length = 0; | |
int front = -1; | |
int rear = -1; | |
int *queue = nullptr; |
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
function createElement (name, attrs, ...children) { | |
name = name.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase() | |
const $el = document.createElement(name) | |
if (attrs) { | |
for (const [attr, val] of Object.entries(attrs)) | |
$el.setAttribute(attr, val) | |
} |
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
const id = 'RenameChunkPlugin' | |
module.exports = class RenameChunkPlugin { | |
constructor (filenameMap) { | |
this.filenameMap = filenameMap | |
} | |
apply (compiler) { | |
compiler.hooks.thisCompilation.tap(id, compilation => { | |
compilation.hooks.optimizeChunkModules.tap(id, chunks => { |
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 <iostream> | |
void merge(const int l, const int m, const int h, int* arr) { | |
const int len = h - l + 1; | |
int* const temp = new int[len]; | |
int i = l; | |
int j = m + 1; | |
int k = 0; |
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 <iostream> | |
void swap (int* arr, int i, int j) { | |
const int temp = arr[i]; | |
arr[i] = arr[j]; | |
arr[j] = temp; | |
} | |
void heapify (int* arr, int max, int root) { | |
const int left = root * 2; |
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 <iostream> | |
#include <vector> | |
#include <array> | |
#include <climits> // INT_MAX | |
#include <algorithm> // find | |
using namespace std; | |
using edges_t = vector<array<int, 2>>; | |
using graph_t = vector<edges_t>; |
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 <iostream> | |
#include <queue> | |
#include <string> | |
#include <map> | |
using namespace std; | |
struct Trie; | |
using trie_t = map<char, Trie*>; |
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 <iostream> | |
#include <string> | |
#include <vector> | |
#include <cstdarg> | |
#include <climits> | |
using namespace std; | |
int min(int count, ...) { | |
int min = INT_MAX; |
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 <iostream> | |
#include <stdexcept> | |
#include <functional> | |
struct Node { | |
int data; | |
Node *next; | |
}; | |
using fn = std::function<void(Node*)>; |