Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.
Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the third node
with val...
分类:
其他好文 时间:
2015-08-09 09:33:13
阅读次数:
152
二叉树数据结构声明:
struct TreeNode
{
int val;
TreeNode *left;
TreeNode *right;
};
1、递归求二叉树深度
int getDepth(TreeNode *root)
{
if (root == NULL)
{
return 0;
}
re...
分类:
其他好文 时间:
2015-08-09 08:24:11
阅读次数:
204
看下面一个链表结点的定义:struct ComplexListNode{ int val; struct ComplexListNode *next; struct ComplexListNode *sibling; ComplexListNode(int x) : val(x), next(NU....
分类:
其他好文 时间:
2015-08-09 00:16:37
阅读次数:
190
$(function() { var val; $("#add").live("click",function() { //使用.live("事件名称",方法) 调用隐藏的事件 val=$(this).prev().val(); });});
分类:
Web程序 时间:
2015-08-08 21:09:50
阅读次数:
144
思路:数组元素删除操作较麻烦,这里采用的是交换元素法,利用两个指针分别指数组的开头下标和尾部下标,把要删除的元素放在数组的最后,最后返回前面指针的下标。Java代码: public int removeElement(int[] nums, int val) { int l = ...
分类:
其他好文 时间:
2015-08-08 19:36:56
阅读次数:
162
本节主要内容
上下文界定(Context Bound)
多重界定
类型约束
型变
1. 上下文界定在第十七节中的类型参数(一)中,我们提到视图界定可以跨越类继承层次结构,其后面的原理是隐式转换。本节要介绍的上下文界定采用隐式值来实现,上下文界定的类型参数形式为T:M的形式,其中M是一个泛型,这种形式要求存在一个M[T]类型的隐式值:case class Person(val name:String)...
分类:
其他好文 时间:
2015-08-08 18:22:31
阅读次数:
128
/* Sweep*/#include int potpin = 0;//电位器接到A0int val; //存储电位器读取的数值Servo myservo//定义一个舵机void setup() { myservo.attach(9); //连接舵机,舵机信号线接到数字输出9 Serial.beg....
分类:
其他好文 时间:
2015-08-08 11:52:31
阅读次数:
445
从6点调到了现在22:19:07。。脑子晕倒死。用splay做,一开始怎么想也不知道该怎么play。想了个办法,用pos[i]表示编号为i的书在树上的节点编号s[i]表示树上的节点i代表的是哪本书。val[i]表示节点i的权值,这里的权值按照书从上到下的大小顺序来赋值,用来建树TOP:先把树里面代表...
分类:
其他好文 时间:
2015-08-07 23:49:50
阅读次数:
324
package com.leegh.function/** * @author Guohui Li */object PartiaAppliedFunction { def main(args: Array[String]): Unit = { val data = List(1, 2, 3...
分类:
其他好文 时间:
2015-08-07 22:04:26
阅读次数:
109
//级联选项function gjtlchag(){// $('#wrap input[name="payMethod"]:checked ').val(); if($('#gjtlxbjc input[name=gjtlxbjc2]:checked').val()==2){ $('#divGjt....
分类:
其他好文 时间:
2015-08-07 18:42:11
阅读次数:
89