常考算法总结

时间:2019-05-11 23:26:47下载本文作者:会员上传
简介:写写帮文库小编为你整理了多篇相关的《常考算法总结》,但愿对你工作学习有帮助,当然你在写写帮文库还可以找到更多《常考算法总结》。

第一篇:常考算法总结

-------------------------void insertsort(int list[],int n)//直接插入排序 { int i,j,temp;for(i=1;i

for(j=i-1;j>=0;j--)

if(temp

list[j+1]=list[j];

else

break;

list[j+1]=temp;} }-------------------------void incrsort(int list[],int n,int h)//shell排序 { int i,j,temp;for(i=h;i

for(j=i-h;j>=0;j-=h)

if(temp

list[j+h]=list[j];

else

break;

list[j+h]=temp;} }

void shellsort(int list[],int n)//shell排序 { int i,incr=n;do{ incr=incr/3+1;for(i=0;i

incrsort(list,n,incr);}while(incr>1);}-------------------------void bubblesort(int list[],int n)//冒泡排序 { int i,j,temp;for(i=0;i

for(j=i+1;j

{

if(list[i]>list[j])

{

temp=list[i];

list[i]=list[j];

list[j]=temp;

}

} }-------------------------void swap2(int &a,int &b)//引用传值 { int temp;temp=a;a=b;b=temp;} void swap1(int a,int b)//值传值 { int temp;temp=a;a=b;b=temp;} void swap(int *a,int *b)//指针传值 { int temp;temp=*a;*a=*b;*b=temp;} int partition(int list[],int low,int high)//快速排序 { int i=low+1,j=high,temp1;temp1=list[low];do {

while(temp1>list[i])i++;

while(temp1

if(i

{

swap(&list[i],&list[j]);

}

}while(i

swap(&list[low],&list[j]);

return j;}

void quicksort(int list[],int low,int high)//快速排序 { int k;if(low

k=partition(list,low,high);

quicksort(list,low,k-1);

quicksort(list,k+1,high);} }-------------------------void merge(int list[],int *temp,int a,int b,int c,int d,int *k)//两路归并过程 { int i=a,j=b;while((i

{temp[(*k)++]=list[j++];} } while(i<=c){temp[(*k)++]=list[i++];} while(j<=d){temp[(*k)++]=list[j++];} }

void mergesort(int list[],int n)//归并排序 { int *temp=(int*)malloc(sizeof(int)*100);int a,b,c,d,i,k,h=1;while(h

a=0;k=0;

while(a+h

{

c=a+h;

b=c-1;

if(c+h-1>n-1)d=n-1;

else d=c+h-1;

merge(list,temp,a,b,c,d,&k);

a=d+1;

}

for(i=0;i

{list[i]=temp[i];}

h*=2;} }-------------------------void selectsort(int list[],int n)//简单选择排序 { int i,j,small;for(i=0;i

small=i;

for(j=i+1;j

if(list[j]

small=j;

swap(&list[i],&list[small]);} }-------------------------char * nizhi(char *str)//字符串逆置 { char *p=str;int len=strlen(str);int i,j;char temp;

for(i=0,j=len-1;i<=j;i++,j--){ temp=*(p+i);*(p+i)=*(p+j);*(p+j)=temp;}

*(p+len)='';

return p;}-------------------------int x,y;//判断回文数

void judge(int * data,int len)//判断是否回文 { int i,j,f=0;for(i=0,j=len-1;i<=j;i++,j--){ if(*(data+i)!=*(data+j)){ f=1;printf(“%d bu shi hui wen!!n”,x);break;} } if(f==0)printf(“%d shi hui wen!n”,x);}

void separate(int *data,int n)//将数字个十位分开 存入data { int j,k,t;y=0;while(n!=0){ *(data+y)=n%10;n=n/10;y++;} *(data+y)='';

for(j=0,k=y-1;j<=k;j++,k--){ t=*(data+j);*(data+j)=*(data+k);*(data+k)=t;} }-------------------------//单链表逆置

node* nizhi(node* head){ node *p1,*p2,*p3;p1=head;p2=p1->next;while(p2){ p3=p2->next;p2->next=p1;p1=p2;p2=p3;} }-------------------------//统计字符串中不含有重复字符的最大子串长度 int search(char *text){

int lastpos[256], lmax=0, curmax=0;

int i;

for(i=0;i<256;i++)

lastpos[i]=-1;

for(i=0;text[i];i++)

{

if(i-lastpos[ text[i] ] > curmax)

{

curmax++;

lmax =(lmax>=curmax)?lmax:curmax;

}

else

curmax = i-lastpos[ text[i] ];

lastpos[ text[i] ] = i;

}

return lmax;}-------------------------//整数转换成字符串 法一:

while(num){ temp[i]=num%10+’0’;i++;num=num/10;} 再将temp逆序 法二:

itoa(number,string,10);

//字符串转换成整数 法一:

while(temp[i]){ sum=sum*10+(temp[i]-‘0’);i++;} 法二:

int atoi(const char *nptr);-------------------------//字符串循环右移n个

例如

abcdefghijkl n=2 结果为

klabcdefghij 实现:

Void loopmove(char *str,int n){ Char temp[maxsize];Int step=strlen(str)-n;Strcpy(temp,str+step);Strcpy(temp+n,str);*(temp+strlen(str))=’’;Strcpy(str,temp);}-------------------------//单链表排序(简单选择排序)void selectSort(Node *node){

Node *p;/*当前节点*/

Node *q;/*遍历未排序节点*/

Node *small;/*指向未排序节点中最小节点*/

int temp;

for(p = node->next;p->next->next!= 0;p = p->next)

{

small = p;

for(q = p->next;q->next!= 0;q = q->next)

if(small->value > q->value)

small = q;

temp = p->value;

p->value = small->value;

small->value = temp;

} }

-------------------------

//打印一字符串,数字正常打印,小写正常打印,大写转换成小写打印,其他字符不打印 for(i=0;i=48&&(int)str[i]<=57)printf(“%c”,str[i]);

if((int)str[i]>=65&&(int)str[i]<=90)printf(“%c”,str[i]);

if((int)str[i]>=97&&(int)str[i]<=122)printf(“%c”,(char)((int)str[i]-32));

}-------------------------//二分法查找

int halfsearch(int list[],int low,int high,int k){ int i,j,mid;i=low;j=high;if(i<=j){ mid=(i+j)/2;if(list[mid]==k)return mid+1;else {if(list[mid]

else return halfsearch(list,low,mid-1,k);} } else return 0;}-------------------------//单链表中已知一个指针p指向一个结点,p非头结点也非尾结点,如何删除p指向的结点

p->data=p->next->data;p->next=p->next->next;-------------------------//计算str中子串sub出现的次数,str为原字符串,sub为子串 //判断两字符串是否相等,相等返回1,不等返回0 int Judge(char *movePt,char *tempPt){

int i;

for(i = 0;i < strlen(tempPt);i++, movePt++)

{

if(*movePt!= tempPt[i])

return 0;

}

return 1;} //计算子串出现的次数,str为原字符串,sub为子串 int StrCount(char *str,char *sub){

int count = 0;

char *move = str;

if(strlen(str)< strlen(sub))

{

return 0;

}

else

{

while(strlen(move)>= strlen(sub))

{

if(Judge(move, sub))

{

count++;

}

move++;

}

}

return count;}

-------------------------补充:

12.单例模式

public class MyBean {

private static MyBean instance = null;

private MyBean(){}

public static synchronized MyBean getInstance(){

if(instance == null){instance = new MyBean();}

return instance;

}

} 13.回调函数

回调函数就是一个通过函数指针调用的函数。如果你把函数的指针(地址)作为参数传递给另一个函数,当这个指针被用为调用它所指向的函数时,我们就说这是回调函数。回调函数不是由该函数的实现方直接调用,而是在特定的事件或条件发生时由另外的一方调用的,用于对该事件或条件进行响应。14.句柄

句柄,是整个windows编程的基础,一个句柄是指使用的一个唯一的整数值,是指一个四字节长的数值,用于标志应用程序中的不同对象和同类对象中的不同的实例,诸如,一个窗口,按钮,图标,滚动条,输出设备,控件或者文件等,应用程序能够通过句柄访问相应的对象的信息。但是,句柄不是一个指针,程序不能利用它句柄来直接阅读文件中的信息。如果句柄不用在I/O文件中,它是毫无用处的。句柄是windows用来标志应用程序中建立的或是使用的唯一整数,windows使用了大量的句柄来标志很多对象。

// 八皇后问题(采用回溯法求解)#include #include using namespace std;

bool place(int,int,int *);void NQueens(int,int, int*);void NQueens(int,int *);static int sum=0;

int main(int argc, char* argv[]){ int x[8];NQueens(8,x);cout<<“总共有”<

}

bool place(int k,int i,int* x){

//判定两皇后是不是交叉

for(int j=0;j

if((x[j]==i)||(abs(x[j]-i)==abs(j-k)))

return false;

return true;}

void NQueens(int k,int n,int* x){ for(int i=0;i

if(place(k,i,x)){

x[k]=i;

if(k==n-1){

for(i=0;i

cout<

cout<

++sum;

}

else NQueens(k+1,n,x);

} } }

void NQueens(int n,int* x){ NQueens(0,n,x);}

第二篇:常考词频总结

常考词频总结

available

suit certain

raise

transform

comparative charge

transmit

yield

transfer

transport

adapt

adopt

alter

arise

arrange

assemble

cancel

continually event

extensive

leak

length

present range rise

access

account

accumulate accurate

adequate affair

affect applicable approachable approve

arouse

artificial

attend

bargain

bring

capacity

case

consequently consider

considerable continuous

cultivate

deliver

demand dense

dispute

enormous

exaggerate

exhaust

exposure

extend

extent extra

feature

gap

gather

generous

grant

guilty

impact

impression incident

increase

inform

injure

intensive interval

involve

lead lively

look

mark

minimum

mood

normal

oblige

obvious

offer

order

omit original

pace

perform

possibility preferable probability publish

question

rank

rate

refuse

regard

regular

regulate

remedy

responsible result

resist

retain

rewrite

rigid

scold

settle

spoil

spot

status step

stick

suppose

take

tense

trace

transmission trouble

turn

urgent

vary

view

vigorous

virtue

yield

almost

attack

abandon

absent absolutely abundant

abuse

acceptable accomplish accuse

acknowledge acquaint

acquire

actually

adaptable

add

adjust

advertise advisable

aggressive

alike

alive

allow

along

amaze

ambitious amount

amuse

annually

anxiety

anxious any

appeal

appearance apply

appointment appreciate approve arbitrary

assessment assignment associate

assume

attach 52

attainable

attempt

attend

attention

attitude

attraction

attribute

avenue

average

avoid

awkward

badly

bare

barrel

barrier

basket

battery

beneficial

benefit

bite

black

blame

blank

blast

bloom bold

compete convenient complete convert completely

coordinate comprehensively

correct compress

cost

bother

bound

break

breed

burst

carry

challenge chance change

characteristics

cheat claim

classify

collected

comfortable comment

compare

comprise

concern confident

confirm

confuse

conservative considerate consistent consistently constantly

consult

consume

contain content contrary contrast contribute 53

counting courage course crash

crime crisis

crude curiosity curious

damage

dark debate decision decrease delay delicate deny

desert desire destroy determination devote diagram differ direction dislike dispose distance disturb draw drop each earn edge educate effect effective efficient emotion

emphasize employ endure

enlightened ensure entitle equal equivalent erect essentially exception exception excess excessive exchange exclusively exhibition expand expansion expansive expense expensive

extension

extremely face faith false fame favor favorite feeling fill finish fixed flat flow fluent fluid follow forceful form fresh fulfill fully

fundamentally furnish gain generate genuine glimpse gradually grasp growth guarantee guide hard hardly harm harsh heavily heighten high hollow hope hurry hurt

idleness ignore imply impose impress inability incapable incline include

indifferently

indispensable individual inevitably infinite inform inform inhabitant inquire insensible insert insignificantly instant 55

intensive intention interfere interview invite isolate issue join judge know

label lack large last lasting late later latter laziness leak level liable

liberal lie light likely liking live living lodger lonely long maintain manually

automatically matter mean mild mind miserable modest motivation multiply nearly

necessarily necessities neglect nuisance numerous object

observation occupy offend one opinion opportunity

optimistic optional ordinary outstanding overlook pair partial

particularly passion peculiarly

permit

perspective pile pitch plunge point pollute possession postpone potential pour poverty prepare prevent price private profitable progress prohibit promise promote properly

property propose provision purchase purpose puzzle quantity quite quote rack rainbow reaction ready reality realize receive recommend reduce regard regardless reinforce relate

relate relation relation relatively release relieve remarkably remove replace request require reserve resident resistant response result reveal reverse revise ribbon rob roughly

rude rush scale scarce scene scope scratch seat secure seek seize seldom sentence separate seriously service set

settlement settler severely shame shape

share shift short shrink side sight signal significance significant single slight smooth sole solution some sorry span spare speed spend split stain

stimulate sting store strength strive strong stuff supply supreme surprisingly survive sustain swallow synthetically tame tear tedious temper tend tender tidy tie

tight time tolerate touch tough track tradition tragedy translate transplant treat

tremendous unceasingly undergo uniform unlike unnatural unreal vacant vacuum violently vision

wear withdraw witness wonder worry wreck 59

第三篇:常考词频总结

常考词频总结

available

raise

charge

transfer

transport

adapt

adopt

alter

arise

arrange

assemble

continually event

extensive

leak

length

present rise

suit transform

transmit

access

account

accumulate accurate

adequate affect applicable approachable

approve

arouse

artificial

attend

bargain

bring

capacity

case

certain

consequently

considerable

continuous

cultivate

deliver

demand dense

dispute

enormous

exaggerate

exhaust

exposure

extend

extent

feature

gap

gather

generous

grant

guilty

impact

impression

incident

increase

inform

injure

intensive interval

involve

lead lively

mark

minimum mood

oblige

obvious

omit original

perform

possibility preferable probability publish

question

rate

refuse

regard

regular

regulate

remedy

responsible resist retain

rewrite

rigid

scold

settle

spoil

spot

status

suppose

tense

trace

transmission urgent

view

vigorous

virtue

yield

abandon

absent absolutely abundant

abuse

acceptable accomplish accuse

acknowledge acquaint

acquire

actually

adaptable

advertise advisable

aggressive

alike

alive

along

amaze

ambitious amount

amuse

annually

anxiety

anxious

appeal

appearance apply

appointment appreciate

approve arbitrary

assessment assignment associate

assume

attach attack

attainable

attempt

attend attention

attitude

attraction

attribute

avenue

average

awkward

bare

barrel

barrier

basket

battery

beneficial

benefit

bite

blame

blast

bloom bold

bound

breed

burst

challenge characteristics

cheat

claim

classify

collected

compete

complete completely

comprehensively compress

comprise

concern confident

confirm

confuse

conservative

considerate consistent consistently

constantly

consult

consume contain content contrary contrast contribute convenient convert coordinate correct cost counting courage course crash crime crisis crude curiosity curious damage

dark debate decision decrease delay delicate deny desert desire destroy determination devote diagram differ direction dispose distance disturb draw edge educate effect

effective efficient emotion emphasize employ endure enlightened ensure entitle equal equivalent erect essentially exception exception excess excessive exchange exclusively exhibition expand expansion

expansive expense expensive extension extremely faith false fame favor favorite feeling fill fixed flat flow fluent fluid forceful fresh fulfill fundamentally furnish

generate genuine glimpse gradually grasp growth guarantee guide harsh heavily heighten hollow idleness ignore imply impose impress inability incapable incline include indifferently

indispensable individual inevitably infinite inhabitant inquire insensible insert insignificantly instant intensive intention interfere interview invite isolate issue judge label lasting laziness leak

liable liberal lodger maintain manually automatically mild miserable modest motivation multiply necessarily necessities neglect nuisance numerous object observation occupy offend opportunity optimistic

optional ordinary outstanding overlook partial particularly passion peculiarly permit perspective pile pitch plunge point pollute possession postpone potential pour poverty prepare prevent

price private profitable progress prohibit promise promote properly property propose provision purchase purpose puzzle quantity quite quote rack rainbow reaction reality realize

receive recommend reduce regard regardless reinforce relate relation relatively release relieve remarkably request require reserve resident resistant response reveal reverse revise ribbon

roughly rush scale scarce scene scope scratch secure seize seldom sentence separate seriously service settlement settler severely shame shape shift shrink sight

signal significance significant slight smooth span spare split stain stimulate sting store strength strive stuff supreme surprisingly survive sustain swallow synthetically tame

tear tedious temper tidy tie violently vision withdraw witness wreck tight tolerate touch track tradition tragedy translate transplant treat tremendous unceasingly undergo uniform unnatural unreal vacant vacuum

这些单词有应向就是了,出现在完形填空中必要的时候可以直接选。

第四篇:常考化学方程式总结

常考化学方程式总结

化合反应

木炭在氧气中燃烧(氧气充足)

硫磺在氧气燃烧

镁带在氧气中燃烧

铜丝在氧气中加热

一氧化碳在氧气中燃烧

二氧化碳与水反应

木炭与二氧化碳在高温下的反应

木炭在氧气中燃烧(氧气不充足)

白磷在氧气中燃烧

细铁丝在氧气中燃烧

氢气在氧气中燃烧

钠在氯气中燃烧

氧化钙与水反应

分解反应

水通电分解

高温煅烧碳酸钙

碳酸氢铵受热分解

碱式碳酸铜受热分解

氯酸钾与二氧化锰共热制氧气

碳酸分解

置换反应

氢气还原氧化铜

木炭还原氧化铜

锌与稀盐酸反应

镁与稀硫酸反应

铁与稀盐酸反应

锌与硫酸铜反应

水蒸气通过炙热的炭层

氢气还原三氧化钨(WO3)

锌与稀硫酸反应

镁与稀盐酸反应

铁与稀硫酸反应

湿法炼铜的原理

其它反应

二氧化碳使澄清石灰水变浑浊

氢氧化钠吸收二氧化硫气体

氧化铜与稀盐酸反应

氧化铁与稀硫酸反应

一氧化碳还原氧化铜

甲烷燃烧

氧化铜与稀硫酸反应

氧化铁与稀盐酸反应

一氧化碳还原氧化铁

酒精燃烧

重要化学方程式巩固

白磷在氧气中燃烧

水通电分解

实验室制氧气

甲烷燃烧

氢氧化钠溶液与硫酸铜溶液混合木炭还原氧化铜

实验室制备二氧化碳

铁丝在氧气中燃烧

高温煅烧石灰石

生石灰与水反应

二氧化碳使澄清石灰水变浑浊

氢氧化钙溶液与碳酸钠溶液反应

氯化钡溶液与硫酸溶液反应

一氧化碳还原氧化铁

第五篇:初三常考化学方程式总结

初三化学常考方程式小结

【带有※期末考试前一定要记熟】

MnO※2HO====2HO+O↑实验室用过氧化氢(双氧水)和二氧化锰制备氧气 2

2222

MnO※2KClO====2KCl+3O↑实验室用氯酸钾和二氧化锰制备氧气 2

△※2KMnO====KMnO+MnO+O↑实验室分解高锰酸钾制备氧气 42422

※CaCO+2HCl==CaCl+HO+CO↑【实验室制备二氧化碳】 3222

※Ca(OH)+CO===CaCO↓+HO现象:澄清石灰水变浑浊【用于检验二氧化碳】 2232

※Fe+CuSO==FeSO+Cu44

※FeO+3CO23

322 现象:红色固体逐渐变成黑色【工业炼铁的原理】 ※CaCO高温====CaO+CO↑【煅烧石灰石;工业制二氧化碳;制生石灰(CaO)】 ※3Fe+2O点燃====FeO23

2224※2H+O点燃====2HO【点燃可燃性气体(氢气、甲烷、一氧化碳)前应先验纯】 ※NaCO+2HCl==2NaCl+HO+CO↑ 2322

点燃4P+5O2====2P2O5现象::红磷燃烧,产生大量白烟

点燃CH4+2O2====CO2+2H2O【天然气燃烧】

点燃C2H5OH+3O2====2CO2+3H2O【酒精(乙醇)燃烧】

Zn+H2SO4==ZnSO4+H2↑

Zn+2HCl==ZnCl2+H2↑ 现象:锌逐渐溶解,有气体生成Fe+H2SO4 ==FeSO4+H2↑现象:铁慢慢溶解,溶液由无色变成浅绿色,同时放出气体1

Fe+2HCl==FeCl2+H2↑ 现象:溶液由无色变成浅绿色,同时放出气体

2Al+3H2SO4 ==Al2(SO4)3+3H2↑ 现象:铝逐渐溶解,有气体生成2Al+6HCl==2AlCl3+3H2↑ 现象:铝逐渐溶解,有气体生成【前面几条的反应通式:(H)前的金属+酸(盐酸、稀硫酸)=盐+ H2↑,注意金属的化合价】

点燃2Mg+O2====2MgO 现象:镁条在空气中剧烈燃烧,出耀眼的白光

点燃S+O2 ====SO2现象:硫在空气中燃烧,发出淡蓝色的火焰,生成有刺激性气味的气体。

点燃C+O2====CO2

点燃2C+O2====2CO

下载常考算法总结word格式文档
下载常考算法总结.doc
将本文档下载到自己电脑,方便修改和收藏,请勿使用迅雷等下载。
点此处下载文档

文档为doc格式


声明:本文内容由互联网用户自发贡献自行上传,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任。如果您发现有涉嫌版权的内容,欢迎发送邮件至:645879355@qq.com 进行举报,并提供相关证据,工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。

相关范文推荐

    金融常考知识点总结

    1.传统的中央银行的三大基本职能¡发行的银行3. 汇率的标价方法(1)直接标价法:以一定单位衍生性金融工具是指有基础性工具派生而来,其金融市场的主体——交易者。金融市场的客......

    《三国演义》常考知识点总结

    《三国演义》常考知识点总结 【中考乐冲刺“做的更少考得更好”】 1、《三国演义》中忠义的化身是关羽,我们所熟知的他忠、义、勇、谋、傲的事情分别有:千里走单骑、华容道义......

    物理常考简答题总结

    绪论 物理环境概论 1.简述人类活动累加对环境和人类自身的伤害。2.概述人居、营建活动的耗能、排废及对环境的影响。3.分析城市化进程中可能引起的城市物理环境变化。4.举例......

    儿科学常考内容总结

    儿科学常考内容总结 儿科学是儿科主治非常重要的学科,在儿科主治考试中占着比较大的比分,对于基础差、信心不足的考生来说,儿科学是比较困难的学科。为了帮助能够顺利通过儿科......

    常用常考成语

    2017高考语文复习必背知识小册 目 录 第一章常用常考成语 第二章、《考试大纲》规定的必背篇目 第三章、中国古代文化常识 第四章、常见文言实词120例 第五章、常见文言虚......

    常考词汇表

    常考词汇表 A abandon vt. 丢弃;放弃,抛弃 aboard ad. 在船(车)上;上船 abroad ad. (在)国外;到处 absent a. 不在场的;缺乏的 abundant a. 丰富的;大量的 academic......

    常考百科知识

    百科知识 莎士比亚的三部传奇剧是《辛白林》,《冬天的故事》和:仲夏夜之梦 “好来宝”是哪个民族的即兴诗:蒙古族 中国的第一部电影是京剧:《定军山》 “黄梅戏”是哪个省的地方......

    常考高频成语

    高考常考高频成语,还不快背! 1.按部就班vs循序渐进 【释义】按部就班:指按照一定的条理,遵循一定的程序,通常表达中性或者消极的感情色彩。 循序渐进:指学习、工作等按照一定的步骤......