8.冒泡排序算法的时间复杂度是什么? 时间复杂度是O(n^2)。 1 #include "stdafx.h" 2 #include 3 using namespace std; 4 void Swap(int &a, int &b) 5 { 6 int temp = a; 7 a ...
分类:
其他好文 时间:
2014-08-31 10:23:51
阅读次数:
133
Given a linked list, swap every two adjacent nodes and return its head.For example,Given1->2->3->4, you should return the list as2->1->4->3.Your algor...
分类:
其他好文 时间:
2014-08-30 01:11:08
阅读次数:
286
题目:
Given a linked list, swap every two adjacent nodes and return its head.
For example,
Given 1->2->3->4, you should return the list as 2->1->4->3.
Your algorithm should use only cons...
分类:
其他好文 时间:
2014-08-29 13:13:37
阅读次数:
169
磁盘管理添加新的文件系统分区,当操作系统已经存在,添加新的分区一般系统装载本地磁盘里面实验:一:我们先添加一块硬盘一般添加了磁盘之后,真机里面叫/dev/sdb/dev/sdc,在虚拟机里面会发现是/dev/vdb/dev/vdc好了,现在我们已经添加好了硬盘了。我们要识别硬盘我们发现的硬..
分类:
其他好文 时间:
2014-08-29 02:55:57
阅读次数:
379
函数的参数传递定义:在调用一个函数时,将实参传递给形参。 C++中函数的参数传递有按值传递、地址传递和引用传递3种方式。注意:地址也是一种值,按值传递和按地址传递都是单向的值传递方式,即形参都不会回传给实参。但是由于地址的特殊性,地址传递可以间接地改变实参的值,所以分开讨论。一、按值传递 函...
分类:
其他好文 时间:
2014-08-28 09:38:51
阅读次数:
339
向量vector:vector类型是以容器(Container)模式为基准设计的,也就是说,基本有begin(),end(),size(),max_size(),empty()以及swap()这几个方法。1、访问元素的方法:vec[i]-访问索引值为i的元素引用。(索引值从零起算,故第一个元素是vec[0]。)vec.at(i)-访问索引值为i..
分类:
其他好文 时间:
2014-08-27 18:55:39
阅读次数:
211
在确定了服务器所需要使用的内存后,需要增加1024M的swap空间具体操作:1、dd if=/dev/zero of=/tmp/swap bs=1M count=1024M #创建1024M的文件块2、mkswap /tmp/swap #创建swap文件3、swapon /tmp/swap #激活s...
分类:
其他好文 时间:
2014-08-27 10:34:57
阅读次数:
147
#include using namespace std;void swap(int* p,int* q){ int temp = *p; *p = *q; *q = temp;}//快速排序int partition(int *ptr,int first, int last){ ...
分类:
其他好文 时间:
2014-08-25 21:07:04
阅读次数:
268
最近有些懒,好久没写代码了,现在写个快排练练手吧。public class QucikSort { //此处交换两个数 public static void swap(int a[],int low,int high) { int temp=a[low]; a[low]=a[high]; a[...
分类:
其他好文 时间:
2014-08-24 20:52:32
阅读次数:
179
方法一:新建分区使用fdisk工具新建一个分区[root@VM_168_102_centos~]#fdisk/dev/xvdb
DevicecontainsneitheravalidDOSpartitiontable,norSun,SGIorOSFdisklabel
BuildinganewDOSdisklabelwithdiskidentifier0xad066822.
Changeswillremaininmemoryonly,untilyoudecidetowrite..
分类:
其他好文 时间:
2014-08-22 18:06:09
阅读次数:
342