This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*reference http://users.powernet.co.uk/eton/kandr2/index.html*/ | |
| /* | |
| Exercise 4-1. Write the function strindex(s,t) which returns the position of | |
| the first occurrence of t in s, or -1 if there is none. | |
| */ | |
| #include <stdio.h> | |
| #define SIZE 100 | |
| int strindex(char s[] , char p[]);//return (p in s)?index:-1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #define ElemType int | |
| #define MAXSIZE 100 | |
| /*...ADT stack...*/ | |
| /*数据集定义*/ | |
| typedef struct Stack{ | |
| int stacksize; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Exercise 5-1. As written, getint treats a + or - not followed | |
| by a digit as a valid representation of zero. | |
| Fix it to push such a character back on the input. | |
| */ | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <ctype.h> | |
| #define MAXSIZE 100 | |
| int getch(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| quick sort v1 | |
| http://zh.wikipedia.org/wiki/%E5%BF%AB%E9%80%9F%E6%8E%92%E5%BA%8F | |
| */ | |
| #include<stdio.h> | |
| void qsort(int a[],int left,int right); | |
| int findp(int v[],int left,int right);//find pivot position | |
| void swap(int *,int *); | |
| int main(){ | |
| int a[]={5,4,3,1,4,5,6,8,9,0}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*Exercise 6-1. Our version of getword does not | |
| * properly handle underscores, string constants, | |
| * comments, or preprocessor control lines. Write a better version. | |
| */ | |
| #include <stdio.h> | |
| #include <ctype.h> | |
| #define LIMIT 20 | |
| #define STRCONSTANT 0 | |
| #define COMMENT 1 | |
| #define WORD 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #encoding:utf-8 | |
| from Tkinter import * | |
| import urllib2 | |
| from lxml import html | |
| import os,sys | |
| class App: | |
| def __init__(self,master): | |
| self.label=Label(master,text='输入日记首页地址:') | |
| self.label.pack(side='left',padx=5) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| #include <stdio.h> | |
| #define FILEPATH "/Users/tinylamb/Documents/coding/santi.txt" | |
| int main(){ | |
| FILE *fp; | |
| fp=fopen(FILEPATH,"r"); | |
| char c; | |
| while((c=fgetc(fp))!=EOF) | |
| printf("%c",c); | |
| fclose(fp); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*input :A[n] | |
| * output:k-th large number | |
| */ | |
| #include <stdio.h> | |
| #include <time.h> | |
| #include <stdlib.h> | |
| #define LEN(a) (int)(sizeof(a)/sizeof(a[0])) | |
| #define SWAP(a,b) do{int temp;temp=a;a=b;b=temp;}while(0) | |
| int searchk(int a[],int left,int right,int k); | |
| void print(int a[],int start,int end); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * ========================================================= | |
| * Filename: calculator.c | |
| * Description: deal with expression like this (4+2)*5-6/(2+1) | |
| * number , + - * / , () | |
| * 1.convert in-order to post-order | |
| * 2.you know how to compute post-order expr | |
| * | |
| * ========================================================= | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * ========================================================= | |
| * Filename: maze.c | |
| * Description: backtracking to find a path in maze | |
| * refer: http://blog.csdn.net/synapse7/article/details/14411365 | |
| * ========================================================= | |
| */ | |
| #include <stdio.h> | |
| #include <time.h> | |
| #include <stdlib.h> |