C++/0x06-algorithm3 pattern matching pattern matching 1.소스 // C++ program to implement wildcard // pattern matching algorithm #include #include #include using namespace std; // Function that matches input str with // given wildcard pattern bool strmatch( char str[], char pattern[], int n , int m ) { // empty pattern can only match with // empty string if (m == 0) return (n == 0); // lookup table for storing results of // subproblem.. 2016. 8. 3. stack stack 1.소스 #include #include using namespace std; // User defined stack that uses a queue class Stack { public: queueq; public: void push(int val); void pop(); int top(); bool empty(); }; // Push operation void Stack::push(int val) { // Get previous size of queue int s = q.size(); // Push current element q.push(val); // Pop (or Dequeue) all previous // elements and put them after current // elem.. 2016. 8. 3. Round Robin Scheduling Algorithm Round Robin Scheduling Algorithm 1. 소스1 #include #include #include #include using namespace std; struct process { int no; int at,et,wt,tt; int tet; int t; }; /* reads from keypress, doesn't echo */ int getch(void) { struct termios oldattr, newattr; int ch; tcgetattr( STDIN_FILENO, &oldattr ); newattr = oldattr; newattr.c_lflag &= ~( ICANON | ECHO ); tcsetattr( STDIN_FILENO, TCSANOW, &newattr ); .. 2016. 7. 14. 이전 1 다음