码迷,mamicode.com
首页 >  
搜索关键字:while break continue    ( 40024个结果
并行编程之多线程共享非volatile变量,会不会可能导致线程while死循环
背景大家都知道线程之间共享变量要用volatilekeyword。可是,假设不用volatile来标识,会不会导致线程死循环?比方以下的伪代码:static int flag = -1;void thread1(){ while(flag > 0){ //wait or do somethi...
分类:编程语言   时间:2014-07-09 00:33:01    阅读次数:263
Java Word Break(单词拆解)
给定一个字符串 String s = "leetcode" dict = ["leet", "code"]. 查看一下是够是字典中的词语组成,如果是返回true,否则返回false。 下边提供3种思路 1.动态算法 import java.util.HashSet; import java.util.Set; public class WordBreak1 { publi...
分类:编程语言   时间:2014-07-08 19:24:23    阅读次数:215
【剑指offer】Q17:合并两个排序的链表
def Merge(head1, head2): if head1 == None: return head2 if head2 == None: return head1 psuhead = ListNode(-1) tail = psuhead while head1 and head2: if head1.val < head2.val: cur = head1 ...
分类:其他好文   时间:2014-07-08 18:46:04    阅读次数:227
linux shell 代码块的重定向
代码块的重定向是指在代码块内将标准输入或标准输出重定向到文件,而在代码块外还是保留默认状态,换句话说,代码块重定向指对标准输入或者标准输出的重定向只在代码块内有效。可以重定向的代码块是while、until、for,也可以是if/then,甚至是函数。 while重定向 #!/bin/bash ls /etc> logs while [ "$filename" != "rc.d" ...
分类:系统相关   时间:2014-07-08 18:42:10    阅读次数:278
二叉树三种遍历非递归算法
1.先序遍历非递归算法 #define maxsize 100 typedef struct {     Bitree Elem[maxsize];     int top; } SqStack; void PreOrderUnrec(Bitree t) {     SqStack s;     StackInit(s);     p=t;     while (p!=...
分类:其他好文   时间:2014-07-08 17:13:18    阅读次数:267
Visual Studio 2013 与 14
Visual Studio 2013 与 14 如果 Install Visual Studio on the same computer as Visual Studio in 2013 "14" when CTP 14.0.21730.1 DP, a number of known issues. While we expect that the Visual Stu...
分类:其他好文   时间:2014-07-08 16:09:04    阅读次数:196
【ruby项目,语言提交检查(一)】如何快速学习ruby ?
如何快速学习ruby ? 学习语言最快的思路。 变量,常量,变量类型,操作符, 逻辑语句如 if, else, switch, for, foreach, do while, break, 等等。要学的语言与这些命令相似的命令是什么?了解使用方法即可。 之后,如果是面向对象,就要了解一下关于对象的操作了。 有没有函数库,一般语言都有的。输出命令函数,操作数组,操作字符串,对象属性 操作...
分类:其他好文   时间:2014-07-08 14:35:27    阅读次数:143
ZOJ Monthly, October 2010 ABEFI
ZOJ 3406 Another Very Easy Task #include #include const int N = 100005; char s[N]; int main() { bool f = 0; int size = 0; char ch; while(scanf("%c", &ch)!=EOF) { if( !(ch >= 'a' && c...
分类:其他好文   时间:2014-07-08 13:52:14    阅读次数:265
switch case ,while, do while,enum
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace C_编辑基础 { //枚举的意义就是限定变量的取值范围 enum gender{Male,Female,Unkown}; //声明一个类型,它是枚举类型(定义一个枚举),这个枚举有三个值。...
分类:其他好文   时间:2014-07-08 13:38:36    阅读次数:191
java提高篇(三十)-----Iterator
迭代对于我们搞Java的来说绝对不陌生。我们常常使用JDK提供的迭代接口进行Java集合的迭代。Iterator iterator = list.iterator(); while(iterator.hasNext()){ String string = iterator.next(); //do something...
分类:编程语言   时间:2014-07-08 12:50:53    阅读次数:290
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!