写程序将一个栈按升序排序。对这个栈是如何实现的,你不应该做任何特殊的假设。
程序中能用到的栈操作有:push | pop |isEmpty
最容易想到的就是优先队列来做此题,容易实现。
另外我们可以再用一个栈来实现栈的升序排列。
优先队列:
//优先队列来实现
void sortStack(std::stack& vStk)
{
std::priority_queue, std::gr...
分类:
其他好文 时间:
2014-08-28 02:07:58
阅读次数:
197
1 void tarjan(int u) 2 { 3 dfn[u]=low[u]=++dfs_clock; 4 stack_push(u); 5 6 for (int c=head[u];c;c=nxt[c]) 7 { 8 int v=to...
分类:
移动开发 时间:
2014-08-27 18:36:48
阅读次数:
198
网上搜到的, 在zend studio 里面导入ssh key,这样就可以直接clone/push/pull github上的项目。window -> preferences -> general -> Newwork Connection -> SSH2 -> Key Management在这里你...
分类:
其他好文 时间:
2014-08-27 16:09:17
阅读次数:
287
在package/apps/Mms/src/com/android/mms/transaction/MessagingNotification.java中方法updateNotification()的最后一行之前加入一句:
....
notification.audioStreamType = AudioManage.STREAM_ALARM; //加入这句
nm.noti...
分类:
移动开发 时间:
2014-08-26 15:33:26
阅读次数:
433
C++11支持range-based for循环。这是一个很方便的特性,能省挺多代码。以下代码就能很方便的遍历vector中的元素,并打印出来:12345678std::vector int_vec;int_vec.push_back(1);int_vec.push_back(2);//如果要修改i...
分类:
编程语言 时间:
2014-08-26 15:25:06
阅读次数:
308
[Azure] Notification Hubs注册模式关于Azure Notification Hubs的注册模式,可以参考下列连结的文件内容。Notification Hubs Features - Registration Management文件里介绍了两种注册模式:手机主动注册、服务代理...
分类:
其他好文 时间:
2014-08-26 15:08:16
阅读次数:
189
上次去面试,面试官给了我一个有意思的问题:有两个VC,可以是前后关系(就是前一个push另一个),上面都各有一个textView,前一个的textView的内容,怎么让后一个VC的textView也显示一样的内容,就算是把两个tex...
分类:
Web程序 时间:
2014-08-26 13:50:46
阅读次数:
314
git 使用技巧总结说明: 本地repo已经有啦,对应的远程repo 为tiger, 本地分支为master。问题一:当拉取代码的remote repo仓库为tiger, 而现在要将修改push到remote repo的 develop分支该如何?思路:拉取新的remote_develop_repo...
分类:
其他好文 时间:
2014-08-26 11:20:36
阅读次数:
203
解决百度云推送通知,不显示默认Notification
分类:
其他好文 时间:
2014-08-26 11:06:15
阅读次数:
245
当POP,push,dismiss,pressent连续调用的时候,要延迟会使用,- (IBAction)goShoppingCartButtonAction:(id)sender{ [self.navigationController popToRootViewControllerAnimate....
分类:
其他好文 时间:
2014-08-26 09:40:45
阅读次数:
218