Skip to content

Instantly share code, notes, and snippets.

View frakw's full-sized avatar

Sheng-Hao Liao frakw

View GitHub Profile
@frakw
frakw / delete_strictly_increasing_sequences.cpp
Last active October 18, 2020 18:28
Delete Strictly Increasing Sequences
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#define isdigit(x) (((unsigned int)x - '0') < 10u)
void print_num(int n){//只能丟正數進來
if (n > 9){
int a = n / 10;
n -= 10 * a;
print_num(a);
}
@frakw
frakw / calculator.cpp
Created October 18, 2020 18:38
Calculator
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#define MAX_SIZE 71//stack最大容量,依題目所訂
#define PUSH (size++)//push新東西進stack,並將size+1
#define POP (--size)//從stack pop出最上面的東西,並將size-1
#define TOP (size-1)//回傳stack最上面的東西
#define isdigit(x) ((x)>='0' && (x)<='9')//判斷是否為數字字元
using namespace std;
int my_strlen(char* input);
bool check_brackets(char* input, int length);
@frakw
frakw / robdd.cpp
Created October 20, 2020 16:43
digital design project 2
#include<fstream>
#include<iostream>
#include<string>
#include<vector>
#include<sstream>
#include<bitset>
using namespace std;
class Node {
public:
int else_edge,then_edge;//index of arrayreduced_order()
@frakw
frakw / Maze.cpp
Created October 24, 2020 09:58
10/24 17:57
/************************************************************************
File: Maze.cpp
Author:
Stephen Chenney, schenney@cs.wisc.edu
Modifier
Yu-Chi Lai, yu-chi@cs.wisc.edu
Comment:
(c) 2001-2002 Stephen Chenney, University of Wisconsin at Madison
Class header file for Maze class. Manages the maze.
#include <iostream>
#include <sstream>
#include <string>
using namespace std;
template<typename T>
class BST_node {//BST節點的class
public:
BST_node() {}
BST_node(T _data):data(_data) {}
#include <iostream>
using namespace std;
template<typename T,unsigned int order>
class B_tree_node {//B樹節點
public:
//constructor
B_tree_node() {set_null();}//啥都沒
B_tree_node(B_tree_node<T, order>* f) : father(f) {set_null();}//有給爸爸
B_tree_node(T new_data) {//有給資料
set_null();
@frakw
frakw / input.dot
Last active December 9, 2020 11:51
digraph STG {
rankdir=LR;
INIT [shape=point];
a [label="a"];
b [label="b"];
c [label="c"];
d [label="d"];
e [label="e"];
f [label="f"];
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
template<typename element,typename order>//element是heap內的資料型別(int),order是優先權的資料型別(char)
class heap_node {//heap node的class
public:
heap_node() {}
heap_node(element i, order p, heap_node<element, order>* f) : data(i), priority(p),father(f) {}
template<typename, typename> friend class heap;
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <iomanip>
using namespace std;
template<typename N,typename P>
//N 為名稱資料型別 P為probability資料型別
@frakw
frakw / word_checker.cpp
Created December 29, 2020 16:03
HOMEWORK 5-1
#include <fstream>
#include <string>
#include <set>
#include <iostream>
#include <numeric>
#include <unordered_map>
#include <iterator>
#include <chrono>
#include <sstream>
using namespace std;