Skip to content

Instantly share code, notes, and snippets.

@nvmnghia
nvmnghia / gen_combination.cpp
Created June 11, 2021 13:57
C++ Combination Generator
#include <iostream>
#include <stdexcept>
#include <vector>
#include <sstream>
using namespace std;
int nCk(int n, int k);
class CombinationGenerator
@nvmnghia
nvmnghia / DocumentTreeWalk.kt
Created December 13, 2020 18:26
DocumentTreeWalk
package com.uet.nvmnghia.yacv.parser.helper
import androidx.documentfile.provider.DocumentFile
import java.io.IOException
import java.util.*
/**
* A port of [FileTreeWalk] for a tree [DocumentFile].
*/
@nvmnghia
nvmnghia / ManualPolling.java
Created April 12, 2019 17:49
Convert to ArrayList by manual polling
import java.util.PriorityQueue;
class Student implements Comparable<Student> {
private int id;
private String name;
private double cgpa;
public Student(String name, double cgpa, int id) {
this.id = id;
this.name = name;
@nvmnghia
nvmnghia / Constructor.java
Created April 12, 2019 17:46
Convert to ArrayList by passing to its constructor
import java.util.PriorityQueue;
class Student implements Comparable<Student> {
private int id;
private String name;
private double cgpa;
public Student(String name, double cgpa, int id) {
this.id = id;
this.name = name;