最近看数据结构,把常用的排序算法用C语言写了一下。
没有按数据结构上的定义SqList结构体,只是用数组的形式实现。
有的算法并没有完全按书上给出的算法,但思路一致。
#include
void InsertSort(int[], int); //直接插入排序 无哨兵
void BInsertSort(int[], int); //折半插入排序
void BubbleSort(int[], ...
分类:
编程语言 时间:
2016-05-12 16:17:59
阅读次数:
269
1、//新的方法,登陆成功之后(旧的方法就不管了)
- (void)locationManager:(CLLocationManager *)manager
didUpdateLocations:(NSArray *)locations
//locationManager:didUpdateLocations:(调用很频繁)
//更新位置的方法之后就调用这个方法,数组中是按照时...
分类:
其他好文 时间:
2016-05-12 16:15:05
阅读次数:
124
一、概括
理解物体形状或轮廓的另外一种有用的方法是计算一个物体的凸包(convex hull)然后计算其凸缺陷(convexity defects)。很多复杂物体的特性能很好的被这种缺陷表现出来。
二、相关函数
1、发现点集的凸外形
CvSeq* cvConvexHull2( const CvArr* input, void* hull_storage=NULL,
...
分类:
其他好文 时间:
2016-05-12 16:08:46
阅读次数:
639
#include
#include
typedef int ElementType;
void Swap(int &a,int &b) {int n;n=a,a=b,b=n;}
//--简单排序--
//冒泡排序
void Bubble_Sort(ElementType A[],int N)
{
int flag;
for(int P=N-1;P>=0;P--)
{
flag=0;
...
分类:
编程语言 时间:
2016-05-12 16:06:07
阅读次数:
211
assert宏的原型定义在中,其作用是如果它的条件返回错误,则终止程序执行。
库函数: assert.h
原型定义: void assert( int expression );
assert的作用是现计算表达式 expression ,如果其值为假(即为0),那么它先向stderr打印一条出错信息,然后通过调用 abort 来终止程序运行。
例程:
#include
#in...
分类:
编程语言 时间:
2016-05-12 15:46:49
阅读次数:
171
更多查找可以参考 http://www.cnblogs.com/liuling/p/2013-7-24-01.html 这是别人的资源,感觉写的很全。可以仔细研究一下。
/*
使用折半查找的前提是数据是有序(升序)的。
*/
class HalfSearchDemo
{
public static void main(String[] args)
{
int[] arr={1,...
分类:
编程语言 时间:
2016-05-12 15:46:42
阅读次数:
150
今天总结一下java中可变参数这个知识点。还是来看一个例子,现在我想写个方法来计算两个整形的和并且输出,这个方法很简单:public class KeBian {
public static void main(String[] args) {
sum(5,9);
} public static void sum(int a,int b) {
i...
分类:
编程语言 时间:
2016-05-12 15:44:24
阅读次数:
134
Java程序设计总复习题
1、编写一个Java程序在屏幕上输出“你好!”。(p13,例1-1)
//programme name Helloworld.java
public class Helloworld {
public static void main(String args[]) {
System.out.print ("你好!" );
}
...
分类:
编程语言 时间:
2016-05-12 15:41:44
阅读次数:
275
#include
#include
#include
#include
#define N 35
void print(int [][N]);//输出函数
void movebul(int [][N]);//子弹移动函数
void movepla(int [][N]);//敌机移动函数
void setting(void);//设置函数
void menu(void);/...
分类:
其他好文 时间:
2016-05-12 15:37:46
阅读次数:
125
之前在学习STL库中的析构工具destory()时,提到过这样一句话,此函数设法找到元素的数值型别,进而利用__type_traits
让自己困惑的程序:
template
void destroy(T *pointer)
{
pointer->~T();
}
template
void destroy(...
分类:
其他好文 时间:
2016-05-12 15:37:23
阅读次数:
357