1.方法与顺序无关
2.枚举绑定数据类型
enum {
ObjectiveC,
Java,
Ruby,
Python,
Erlang
};
typedef NSUInteger Language;
...
分类:
其他好文 时间:
2014-08-14 01:37:17
阅读次数:
220
许多应用程序都需要处理有序的元素,但不一定要求全部有序。一个合适的数据结构应该支持两种操作:删除最大元素和插入元素。 1 #include 2 #include 3 using namespace std; 4 5 6 struct node 7 { 8 int priority; ...
分类:
其他好文 时间:
2014-08-14 01:04:47
阅读次数:
268
#include using namespace std;struct Node{ Node *next; int data;};void createCircle(Node* &L,int n,int k){ int i = 0; Node*p = L; p ...
分类:
其他好文 时间:
2014-08-14 01:03:47
阅读次数:
216
#include #include using namespace std;const int maxn = 250000 + 10;int tot;struct Node{ Node * ch[26],*f; int l;} nd[maxn l = last->l + 1; last = p; f...
分类:
其他好文 时间:
2014-08-14 00:57:37
阅读次数:
236
??
冒泡,快排都是常见的排序方法,这里介绍用头文件中的qsort函数排序。不过自己要先一个cmp函数。
#include//qsort的头文件
int a[100]={0,2,4,1,5,7,3,8,9}; //要排序的数组
struct Person//要排序的结构体
{
char num[20];
char name[100];
int score;
int sum;
}man...
分类:
其他好文 时间:
2014-08-13 22:39:27
阅读次数:
330
题意:一共有四个方向,从’@‘出发,找能到达‘.’的个数, #是不能通过的.
策略:广搜。
这道题属于最简单的bfs了。
代码:
#include
#include
#include
using std::queue;
bool vis[25][25];
char s[25][25];
int n, m;
int ans = 0;
struct node{
int x, y;
};
no...
分类:
其他好文 时间:
2014-08-13 22:31:17
阅读次数:
301
题意:。。。
策略:动态规划。
因为是求至少能得到一个offer的概率,那我们可以反着求,求得不到一个offer的概率,最后用1减去就好了.
代码:
#include
#include
double dp[10010];
struct node{
int a;
double b;
}s[10010];
int main()
{
int n, m, i, j;
...
分类:
其他好文 时间:
2014-08-13 22:30:47
阅读次数:
229
readdir, readdir_r - 读一个目录readdir函数: struct dirent *readdir(DIR*dirp);The data returned by readdir() may be overwritten by subsequent callsto readdi.....
分类:
编程语言 时间:
2014-08-13 22:06:57
阅读次数:
386
cpuset子系统为cgroup中的任务分配独立CPU(在多核系统)和内存节点。cpuset_cgroup的cpus_allowed和mems_allowed定义
了该cpuset包含的cpu和内存节点,其中进程的task_struct->cpus_allowed与进程所属cpuset的cpus_allowed保持一致,在进程分配
物理页框时(alloc_pages系函数),通过cpuset_...
分类:
其他好文 时间:
2014-08-13 18:53:47
阅读次数:
152
单链表是一种递归结构,可以将单链表看作特殊的二叉树(我把它叫做一叉树)单链表的定义:/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * List...
分类:
其他好文 时间:
2014-08-13 18:37:17
阅读次数:
213