利用二级指针删除链表内一个元素,传统的做法是:找到将要删除元素的前一个指针,然后再删除当前元素。代码示例:void delete_node( elem_type x, struct node* l ){struct node* p = find_prev ( x, l );if ( !p->...
分类:
其他好文 时间:
2014-07-19 09:38:58
阅读次数:
240
判断两直线p1p2与q1q2是否相交,用向量叉积来判断如果P x Q >0,则P在Q的顺时针方向;如果P x Q #include #include #include #include typedef struct node{ double x,y;}point;point p1,p2,q1,...
分类:
其他好文 时间:
2014-07-19 09:38:36
阅读次数:
279
结点定义:1 /*2 * Huffman树结点定义3 */4 struct Node5 {6 ElementType weight; // 结点的权值7 struct Node *leftChild; // 结点的左指针8 struct Node ...
分类:
其他好文 时间:
2014-07-19 09:19:34
阅读次数:
225
用到tire树;
基础应用
这里讲的挺详细的 点击打开链接
#include
#include
#include
#define max 20
using namespace std;
char w[6];
struct node{
bool a;
int chile[26];
int q;//前缀
node(){
q=false;...
分类:
其他好文 时间:
2014-07-19 08:26:00
阅读次数:
181
题目如下:
Bandwidth
Given a graph (V,E) where V is a set of nodes and E is a set of arcsin VxV, and an
ordering on the elements in V, then the bandwidth of a node
v is defined as...
分类:
其他好文 时间:
2014-07-19 02:26:15
阅读次数:
206
Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors.OJ's undirected graph serialization:Nodes are labeled u...
分类:
其他好文 时间:
2014-07-19 00:05:00
阅读次数:
201
以下是二叉搜索树中查找、插入、删除的递归和非递归算法数据类型设计:1 struct BSTNode 2 {3 ElementType data; // 结点元素值4 struct Node *leftChild; // 左子树根结点5 ...
分类:
其他好文 时间:
2014-07-18 19:05:40
阅读次数:
279
class Solution {public: ListNode *removeNthFromEnd(ListNode *head, int n) { if (head == NULL) return NULL; ListNode* pre = NULL; ...
分类:
其他好文 时间:
2014-07-18 18:24:55
阅读次数:
209
/// /// 双向链表节点类 /// /// 节点中的存放的数据类型 public class Node where T:IComparable { /// /// 当前节点的数据 /// T data; /// /// 节点中存放的数据 /// pu...
分类:
其他好文 时间:
2014-07-18 18:22:59
阅读次数:
272
按照 演示的代码 直接运行会出错,大家需要调整方式。http://koajs.cn/要安装以下$ npm install -g n$ n 0.11.12$ node --harmony my-koa-app.js注意:现在你直接在命令行中运行:node hello.js 是会报错的。错误一般如下:f...
分类:
其他好文 时间:
2014-07-18 18:16:56
阅读次数:
660