Skip to content

Instantly share code, notes, and snippets.

View lavantien's full-sized avatar
🧘‍♂️
chillax

лавантиен lavantien

🧘‍♂️
chillax
View GitHub Profile
@lavantien
lavantien / TowerOfHanoi.cpp
Created September 30, 2018 08:26
Tower of Hanoi game with the ability to choosing the number of discs.
// written by LaVanTien . You have all rights to use and modify this source code :)
// compiled with flag: -std=c++14
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
static vector<int> a, b, c; // 3 towers, start at 'a' and end at 'c'
static int num; // number of discs
static int sum = 0; // number of steps
@lavantien
lavantien / Dictionary.cpp
Created September 30, 2018 08:29
Simple Dictionary console program.
/*
Warning: The following application was written in ISO C++11 standard, so it may incompatible with older C++ standards
Compiled by GCC with -std=c++11 flag
*/
#include <iostream>
#include <string>
#include <fstream>
#include <cstdlib> // for using rand() and srand()
#include <ctime> // for using time()
@lavantien
lavantien / BreakPointQuickSort.c
Created September 30, 2018 08:31
Program for choosing break-point (threshold) for Quick Sort
/*
LaVanTien Present:
Quick-Sort Break-Point Benchmark Program.
*/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
const char *FO = "C:\\Dev\\quicksort_choosingbreakpoint_benchmarks_result.txt"; // Path of Result file.
const int MAX = 1000000; // Maximum array's elements.
@lavantien
lavantien / SortingAlgsBenchmarks.c
Created September 30, 2018 08:33
A Benchmarking Program for various Sorting Algorithms writen in C.
// Sorting Algorithms Benchmarks v0.0
// Created by LaVanTien
// 02/01/2016 6:00 AM
// Compiled at C language - ISO C11
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <time.h>
#define TEMPSIZE 10000
@lavantien
lavantien / ArrayDemoProgram.cpp
Created November 17, 2018 19:41
A demo program for manipulate arrays of integers.
// Compile with std=c++11 or above to avoid conflict.
// gl_ : global variables. us_ : user defined functions. :: : access global variables.
// Tested! All modules work 100%.
#include <iostream>
#include <random>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
@lavantien
lavantien / MaximumValueSort.cs
Created September 16, 2019 17:43
Combine whole integer array into a number called 'x'. Sort the given array so that 'x' is maximum value. This solution using brute-force approach O(n!).
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
namespace TestCS
{
class Program
{
static void Main(string[] args) {
@lavantien
lavantien / LINQExcercises.cs
Created September 17, 2019 09:02
Basic ways to use LINQ on collections.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Collections;
namespace TestCS
{
class Program
{
static void Main(string[] args) {
@lavantien
lavantien / DBConnectExample.cs
Last active September 17, 2019 11:40
Example of connecting to SQL Server DB.
using System;
using System.Data.Common;
using System.Configuration;
namespace TestCS
{
class Program
{
static void Main(string[] args) {
string provider = ConfigurationManager.AppSettings["provider"];
@lavantien
lavantien / SPOJ_INOUTEST.java
Last active March 14, 2021 19:46
Template for Java IO Competitive Programming. Fastest Java code yet: 0.41s
package com.lavantien;
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
InputReader ir = new InputReader();
OutputWriter ow = new OutputWriter();
@lavantien
lavantien / biguint.h
Last active April 14, 2021 21:51
biguint - Simple Optimized Big Unsigned Integer Library
/*
Big Unsigned Integer Library (biguint).
Written by Tien La.
User can do anything with this library, since there, I don't have any responsibility about any damage that may occur.
For any question or suggestion, please email me at lavantien96@gmail.com or via Facebook: fb.com/cariyaputta
This library is mainly for demonstration but still quite optimized and pretty fast.
All functions in this library don't return value (except 'GMP' function), instead, they use references to speed things up.
The rule of these function is almost the same: first argument is the result of the function, except 'cmp' and 'wl'.