Skip to content

Instantly share code, notes, and snippets.

View RinChanNOWWW's full-sized avatar
🏄
Surfing the Internet

RinChanNOW RinChanNOWWW

🏄
Surfing the Internet
View GitHub Profile
@RinChanNOWWW
RinChanNOWWW / quick_pow.cpp
Created August 19, 2021 03:20
快速幂运算
#include <type_traits>
template <typename T, typename P>
T qpow(
T a,
typename std::enable_if<std::is_integral<P>::value, P>::type n,
T init) {
T ans = init;
while (n) {
if (n & 1) {
@RinChanNOWWW
RinChanNOWWW / join.cpp
Created April 29, 2021 00:50
join function implementation in c++
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
template <class T>
std::string join(std::vector<T> vec, char connector) {
if (vec.size() == 0) {
return "";
}
@RinChanNOWWW
RinChanNOWWW / heap_sort.cpp
Created April 16, 2021 00:51
Heap sort written in C++
#include <iostream>
#include <utility>
#include <vector>
using namespace std;
void adjustHeap(vector<int>& v, int l, int r) {
int val = v[l];
for (int i = l * 2 + 1; i < r; i = i * 2 + 1) {
if (i + 1 < r && v[i] < v[i + 1]) {
C++ 4 hrs 12 mins ███████████████████▏░ 91.3%
Roff 11 mins ▊░░░░░░░░░░░░░░░░░░░░ 4.1%
SQL 4 mins ▎░░░░░░░░░░░░░░░░░░░░ 1.5%
C 2 mins ▏░░░░░░░░░░░░░░░░░░░░ 1.0%
XML 2 mins ▏░░░░░░░░░░░░░░░░░░░░ 1.0%