linux编程中,如果用到计时,可以用struct timeval获取系统时间。struct timeval的函数原型如下: struct timeval { __kernel_time_t tv_sec; /* seconds */ __kernel_suseconds_t tv_usec; /*...
分类:
其他好文 时间:
2014-07-10 14:30:22
阅读次数:
334
字典树水题。 1 #include 2 #include 3 #include 4 5 typedef struct Trie { 6 bool v; 7 Trie *next[2]; 8 } Trie; 9 10 Trie *root;11 12 bool create(c...
分类:
其他好文 时间:
2014-07-10 14:20:40
阅读次数:
199
struct ABC{ int a; int b; int c;};+----------+ member_name )【分析】:(1) 该宏中,struct_type为结构体类型,member_name为结构体内的变量名 (2) ((struct_type *)0) 是欺骗编...
分类:
其他好文 时间:
2014-07-10 14:19:59
阅读次数:
186
简单字典树。 1 #include 2 #include 3 #include 4 5 #define MAXN 128 6 7 typedef struct Trie { 8 int count; 9 Trie *next[MAXN];10 Trie() {11 ...
分类:
其他好文 时间:
2014-07-10 13:43:34
阅读次数:
239
#include#include/*定义学生结构体*/struct Student{ char ID[20]; char Name[20]; float Mark1; float Mark2; float Mark3; float Avarage;};/*声明学生...
分类:
编程语言 时间:
2014-07-10 12:16:39
阅读次数:
298
字典树。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 using namespace std; 8 9 typedef struct Trie { 10 int in;...
分类:
其他好文 时间:
2014-07-10 00:25:58
阅读次数:
378
试题:给定一个带环的链表,找出环起点。比如:A -> B -> C -> D -> E -> C (C为环形起点)写一个程序找出环起点C。ListNode结构如下,请实现 ListNode* find_circle_beginning(ListNode* head);函数,返回环的起点。struct...
分类:
其他好文 时间:
2014-07-10 00:14:17
阅读次数:
232
表的实现:数组:可以用动态数组实现,但是,删除和插入的开销太大。链表:由内存中一系列不相连的结构连成;每个结构含有表元素和指向下一个结构的指针;链表的实现: ps:为了方便删除和插入,我们设置一个头节点;节点:包含一个元素和指向下一个节点的指针;1 struct Node{2 int E...
分类:
其他好文 时间:
2014-07-09 23:59:48
阅读次数:
401
约瑟夫环形问题有30人将其编号,从头开始1,2,3数数,每到3将其删除,一共删去15个数。输出被删去的15个数#includeusing namespace std;struct LinkList{ int val; LinkList* next; LinkList(int a):val(a)...
分类:
其他好文 时间:
2014-07-09 23:43:04
阅读次数:
246
#include
#include
#include
#include
using namespace std;
struct Node
{
int data;
struct Node* next;
};
struct Node* create_list(int len)
{
if (len <= 0)
return NULL;
struct Node* head;
...
分类:
其他好文 时间:
2014-06-27 23:54:36
阅读次数:
311