3.5ImplementaMyQueueclasswhichimplementsaqueueusingtwostacks.interfaceQueue<T>
{
enqueue(Tt);
Tdequeue();
}
classMyQueue<T>implementsQueue<T>
{
MyQueue()
{
//Initstackss1ands2;
...
}
//O(n)
enqueue(Tt)
{
while(!s2.isEmpty())
{
s1.push(s2..
分类:
其他好文 时间:
2014-11-27 08:05:14
阅读次数:
140
3.6Writeaprogramtosortastackinascendingorder.Youshouldnotmakeanyassumptionsabouthowthestackisimplemented.Thefollowingaretheonlyfunctionsthatshouldbeusedtowritethisprogram:push|pop|peek|isEmpty.interfaceStack<T>
{
push(Tt);
Tpop();
Tpeek();
booleanisEm..
分类:
其他好文 时间:
2014-11-27 08:02:46
阅读次数:
156
// 判断文字是否为空格 (一个或者多个空格) -(BOOL)isEmpty:(NSString *)str{ if (!str) { returntrue; } else { NSCharacterSet *set = [NSCharacterSetwhitespaceA...
分类:
其他好文 时间:
2014-11-26 10:56:09
阅读次数:
175
swift中集合类型有数组和字典数组和字典的区别是数组是有序的,字典类型是无序的 字典有key值1.数组的定义和更新数组的定义是Array 或者[sometype]var 山手线=["日暮里","鹰谷"]山手线.count 可以用来查看数组的个数山手线.isEmpty 可以用来判断数组是否是空的在数...
分类:
编程语言 时间:
2014-11-16 14:41:01
阅读次数:
206
swift中的字符串和字符都兼容unicode定义一个字符串let hello="hello world"初始化一个空的字符串let hello=""let hello=String()判断一个字符串是否为空if hello.isEmpty{println("这是个空字符串")}字符串可以使用+进行...
分类:
编程语言 时间:
2014-11-16 13:15:20
阅读次数:
241
Collection接口的基本方法boolean add(Object o)向集合当中加入一个对象void clear()删除集合当中的所有对象boolean isEmpty()判断集合是否为空remove(Object o)从集合中删除一个对象的引用int size()返回集合中元素的数目Set接...
分类:
其他好文 时间:
2014-11-15 23:11:04
阅读次数:
278
isNull Null 值:变量卜存在,不包含有效数据,未定义,为分配内存 isEmpt 是一个判断函数,返回false或者true。 ?public?boolean?isEmpty()?{? return?size?==?0;? ????} “” 已初始化,已分类内存...
分类:
其他好文 时间:
2014-11-14 12:43:58
阅读次数:
142
定义了一个MyList类
包含的函数:
getHead()返回头指针;
isEmpty() 判断是否为空;
addFirst(T element)在链表的头部加入元素;
addLast(T element)在链表的尾部加入元;
add(T fix...
分类:
编程语言 时间:
2014-11-12 21:23:08
阅读次数:
268
bool IsDigitString(QString strSource){ bool bDigit = false; if (strSource.isEmpty()) { return bDigit; } QByteArray strByteArray = strSource....
分类:
其他好文 时间:
2014-11-09 00:54:16
阅读次数:
1072
public class T { //反转字符串 public static String reverseString(String s){ if(s.isEmpty()) return s; return reverseString(s.substring(...
分类:
编程语言 时间:
2014-11-06 09:15:31
阅读次数:
169