Thursday, August 21, 2008

GoldMan Intern Experience

转贴:高盛实习的感触
转自一个朋友的blog。其实我想大部分人第一次点进来看这篇文章都是冲着GS的名字才点进来的。So do I,of coz。但是很可惜,这篇文章没有提及太多地GS的business,反而更多的是谈及一些Ibanker里一些人的人格魅力。我想这就是我为什么会发到学生板块的原因。我觉得现在的学生在学校里更多的学的事professional的东西,而多少忽略了一些personality的东西。这也无可厚非,学生嘛,本来就应该好好学习。但是我觉得,就像新东方老鱼说的:进入社会后,你能用到你本可学到的也就10%,剩下的就要看你的自学能力,创造能力和社会能力了。下边这些有些也match到一位julian_wang的1篇帖子里提到的。大家有空就好好读读吧,真的能学到很多。-------------------------------------------------------------金融是所有世间万物食物链的最上游。 无论是咨询公司、市场营销、成本控制,都只不过是让最后报表上面的几个数字更加好看的工兵。这就不难理解一个工作三年的VP可能赚的钱可能比很多咨询公司和广告公司的合伙人赚的还多。 金融市场就好比海洋中的食物链,每个热点都会有一群从小鱼到大鱼的饕餮。在香港回归和港股狂飙这次猎食的过程,我有幸作为一只兼职的小鱼在高盛度过了10周,并目睹了恒生穿破23000点和Dow冲破14000的一幕,也经历了次级信贷让恒生一天跌落1200点的历史性时刻。我在Investment Management Division下面的Private Wealth Management (PWM)。PWM is pretty much a Sales and Trading department, and the difference is that Sales & Trading serves institutions and we serve high net worth individual clients。我纯粹是一个accidental banker,因为之前从来对数字和金融没有特别感兴趣过,但是还是有幸学到了很多东西,除了technical之外,分享一些学习体会和大家: Absorb and digest information quicly没有任何一个行业比金融对信息变化更加敏感。从CPI, Interest rate到公司的最新财报,以及实时的股价变化,每天要面对无穷尽的信息,吸收,并宣传有用的信息来快速做出决策,无疑是挑战性很大的。 Bloomberg和Reuters真的是伟大的发明,敲几下键盘,所有实时和历史的财务数据、新闻都在屏幕上。从沈阳回香港的飞机上,自己拿了两份报纸,很快通读一遍,然后发现周围的人还在细细品味。突然发现,不知不觉,自己处理信息的能力和速度已经提高了很多。Re-define hard working 我的一个Mentor给我说, “hard working is given at Goldman Sachs”。但是根据 我的观察和我与人的交流,我发现这个真的是千差万别。如果说成功有什么秘方的话,我真的是发现和hard work的co-relation最大。我的一个老板,每天8点钟准时到公司,和我一起听research call,然后做计划。 他带领的3人团队管理15亿美金的资金,可以和一个对冲基金的规模向匹敌。另外两个top performers,A & R也是格外的努力,每天下班以后还在家里看美国股市的盘。 人平庸与否智力是很关键的,other factors given equal,我真的见识到了为什么成功的人会成功。 无独有偶,我到上海拜访一个做互联网的前辈,公司卖了3亿美金的龙哥。在这个周末的下午,他的合伙人江南春还在给他打电话,要一起看一个公司的材料。他给我讲,周日这一天,陈天桥和江南春都在工作。他给我讲,江南春每年亲自要见1,000多个客户。我的另外一个做投行的朋友也给我讲,在分众上市的前一天,江南春一个人静静地坐在酒店里面,发了400条短信给销售,问销售的业绩。几十亿身价的富豪,每年还亲自见1,000多个客户;七八十岁的李嘉诚,每天还在长江中心的顶层坚持工作。 我之前在创业的时候,曾经认为自己已经非常勤奋了,现在对“勤奋”两个字我有了新的认识,我对自己的极限也有了新的认识。。李嘉诚这些人现在还每天坚持上班。这也就是差距所在。 斯坦福的很多同学认为,这两年的MBA就应该懒一点,享受生活,我一直不同意,现在找到了很大理论和事实支持。True relaxation does not come from doing nothing, but from the confidence and inner satisfaction and inner peace within one’s mind. 工作是充实的,我确实闲不下来。 Business model & strategy always matter如果你认为高盛还是亚洲上市的冠军,你就大错了。In investment banking & PWM,高盛现在都不是最大的,原因就是战略和商业模式。这里太敏感,不多说了。但是战略和商业模式真的是太重要了。“上兵伐谋”,有道理。 Market savvy: Danny He gave us three “open-meetings” to grill us about the market knowledge. The difficult part about “being market savvy” is that I have to memorize an ever changing financial market’s data and news. Unlike history or other industries, all the data, indexes and news are changing everyday in Finance, and the same number will be outdated the same time tomorrow. This is somehow like chasing your own shadow: it moves when you move. However, looking at Danny’s tough request on “market savvy” reminds me of how little Chinese entrepreneurs know about their own company, whose information is either static or does not change much. Even if you just try to impress people, the fact that you can remember all the key information just out of your head is very impressive and helpful. That gives clients and colleagues lots of trust and confidence. Now I request my partners and employees to be savvy about all the information related to our business, and they have to be able to talk more professionally than any competitors. Starve for success: Rickie & AngelWhat can I say? The best performers are those who are always hungry and are never satisfied. Re-define professionalism: Vicky W. 我问一个VP,让她告诉我,从她的observation当中看,成功的VP和不成功的VP通常有什么区别?What did the successful VPs do right and the not-so-successful ones do differently? 其中一个就是专业程度(professionalism)。从开会不迟到这一个最基本的事情,到每天都要把unanswered phone calls & unreturned emails回复一遍,这些最基本的小事区分了成功和不成功的人。即便是已经很晚,你很忙,至少也要回复电话告诉人家说你今天很忙,可以明天通话。是呀,一个连电话都不能接,不能回的人有什么呢?国内很多人有种非常不好的作风,不接听电话也不喜欢回复电话,自己感觉很牛逼。这种人不要合伙,一定不成气候,因为你需要他的时候总找不到他。我深有体会。 去参加摩根斯坦利的dinner,他们给我讲,投行里面分析师最能让人生气的就是电话找不到人,或者请假的时候不给别人余地(先做决定然后请假)。 Tenacity and methodology: Movie Wall street & Rudolf China Team最成功的一个VP之一是一个外国人,讲得一口流利的中文。看到他每天cold call和发prospect letter, 我重新又 认识了什么叫做pitch skills和tenacity。见了一个外国人写的prospect letter,那个用词的当,有理有节,我是真的佩服佩服。 一个老板让我去看1982年版的电影《华尔街》。我虽然没有来的及看,但是其中他让我了解的片段就是一个banker,为了认识一个客户,每年生日的时候给客户送他喜欢的礼物和卡片,并打电话。坚持了12年,最后终于有机会和客户见面,并一起做了一个deal。 某种程度上讲,做banking的辛苦程度不比创业容易,即使是高盛和大摩也经常抢不到deal。品牌有帮助,但是最后起决定作用的还是人本身。Even Goldman has lots of imperfections 高盛也有自身的很多问题,很多人和制度也有很大差距,这个不分享了。 IBD is not the most attractive division at all“思路决定出路,布局决定结局,吨位决定地位”。很很多投行一样,高盛最赚钱的根本不是IBD,虽然IBD给然的光环最大。Trading给公司的收入超过总收入的60%。 Sales & trading和投资都是高盛更加赚钱的部门,他们的pay其实也比IBD要好很多了。除了trading,SS&G和PIA都是不错的部门。IBD可能光环最大也按比例来讲最难进,但却不是pay off最好的部门。 Lesson from Mark Schwin Leave for the meeting and don’t wait for the person who is late。有机会和一个合伙人一起吃早饭,他impress我的一个故事是,如果约好了一起去开会或者见客户,比如约好9点钟在门口见面,他学到的lesson是,等到9:02有一个人还不来,坚决不要再等。不要顾及面子,clients’ interests always come first。 Life is not all about money: Jason Huang投行里面不乏很多high achiever和go getter,但是money driven的人通常burned out也比较快。Jason是最成功的一个副总裁之一,也是我学到最多东西的一个VP。赚钱不是人生的全部,他给我讲了他的很多的故事,每一个我都很感动。从家庭到宗教信仰,到他的每一个career move,从年少轻狂到现在的沉稳,我看到了很多很多我可以学习的地方。 他最后和我分享的一个故事:每个人有很多个“面”,也有很多个 “life”。一个全面发展的人才能成功,也才可以long term succeed。那么这么多life中,人首先要有professional life:职业无疑是一个重要的life,他让我们不要把梦想埋葬在对金钱的追逐之中,而是要做自己真正喜欢的事情。另外一个life就是family life,无论是父母和爱人,自己都有很多责任和义务要履行,in return,我们也从家庭中得到很多。通常,我们能从家庭得到的永远比我们付出的要多。人还要有自己的 “hobby”, “sports life”等等。人的身体在一天天老去衰老不可逆转,唯一的收获应该精神上的更加富足。而又有多少人可以真正精神上越来越富足呢?为了理想,或者说为了贪婪,我们又牺牲了多少呢?Sell with conviction & empathy (Jason Moo & Jason Huang)If you don’t believe in the products/services you are selling, your clients won’t buy in it either. They need confirmation and assurance from you. Selling with confidence, conviction is important. You should be one of those blocksà Wei Kiat 在实习的最后,Associate需要写一个商业计划书,一个新加坡的VP告诉我,客户“选择高盛的理由”这一页我列的4点不对,“至少应该把你作为一种一个理由”。这个给我很大震撼。公司无论多伟大,我们每一个人出去都好比是一个代表,一个窗户来代表公司,在客户选择公司的时候,其实很大程度上也是基于对我们的信任。虽然公司品牌重要,个人也是公司品牌的一个部分,而优秀的个人又会不断强化公司的品牌。 treat every one as your internal client Be professional to every one around you. This is the lesson I learned from my mentor. You can do banking? So can 10 million other people At the end of the program, I realize one thing more than ever. Banking is not a rocket science industry and 10 million other people could easily do it as well. It is really a “monkey business”.

Wednesday, August 20, 2008

create proc

存储过程1 创建存储过程create proc stu_proc1as select count(*) from student
exec stu_proc1 执行
2 修改、删除、重命名alter proc stu_proc1as select * from student
drop proc stu_proc1
sp_rename stu_proc1 old
3 参数存储过程传入参数:create proc stu_proc3@pname char(3)as select * from student where number=@pname
exec stu_proc3 \'103\'
传出参数:create proc stu_proc5@pname char(3),@result char(8) outputas select @result=name from student where number=@pname
declare @a char(8)exec stu_proc5 \'103\',@a outputprint @a//select @a
亦可命名参数、明确指定declare @a char(8)exec stu_proc5 @result=@a output,@pname=\'103\'print @a
4 存储过程的复杂操作使用带有复杂 SELECT 语句的简单过程下面的存储过程从两个表的联接中返回所有学生(提供了姓名)、所学课程。该存储过程不使用任何参数。
USE studentsIF EXISTS (SELECT name FROM sysobjects WHERE name = \'info_all\' AND type = \'P\') DROP PROCEDURE info_allGO
CREATE PROCEDURE info_allASSELECT stu.name,grade.courseFROM stu INNER JOIN grade ON stu.number = grade.number
GO
info_all 存储过程可以通过以下方法执行:
EXECUTE info_all-- OrEXEC info_all
下面的存储过程从四个表的联接中返回所有作者(提供了姓名)、出版的书籍以及出版社。该存储过程不使用任何参数。USE pubsIF EXISTS (SELECT name FROM sysobjects WHERE name = \'au_info_all\' AND type = \'P\') DROP PROCEDURE au_info_allGOCREATE PROCEDURE au_info_allASSELECT au_lname, au_fname, title, pub_name FROM authors a INNER JOIN titleauthor ta ON a.au_id = ta.au_id INNER JOIN titles t ON t.title_id = ta.title_id INNER JOIN publishers p ON t.pub_id = p.pub_idGO
练习1:制作存储过程显示所有年龄大于26的学生create proc age1asselect name from studentwhere year(getdate())-year(birthday)>26
exec age1
练习2:制作存储过程显示所有年龄大于指定大小的学生create proc age2@pdata intasselect name from studentwhere year(getdate())-year(birthday)>@pdata
exec age2 26
存储过程的注意事项:可使用with recompile 和with encryption两者都可放在参数之后,语句之前其中with recompile会导致每次调用存储过程都会编译,效率变低,但执行效率可能优化,或加入到exec age with recompile中,则会根据需要创造新的查询计划
多行储存过程create proc temp as select * from stuselect * from grade

P4P

P4P,全称是“Proactive network Provider Participation for P2P”。P4P主要的想法是,把P2P通讯本地化。P2P在选点配对时并不考虑物理距离,研究数据表明,两个P2P节点的平均距离是1600公里,要跨过5.5个大型网络,并产生大量的数据通讯。如果把P2P的选点限制在相近的节点,就有可能会大大减少数据通讯量,这也就是P4P的主攻方向。
P4P在每个ISP的服务器中安装一个iTracker,它含有整个ISP网络的拓扑结构,P2P的客户机在建立共享连接前,需要下载这个iTracker,并根据网络结构,只和相邻的节点建立连接。实验数据表明,P4P的节点平均距离减小到230公里,数据通讯量减少了5倍,而且性能比P2P还有所提高。
看起来,P4P可能是一个补救P2P的方案,但它不是一个根本的解决办法,而且它也还未通过大型部署的考验。

解决 网络上数据大规模复制的问题。

Tuesday, August 19, 2008

Dijkstra

From :http://www.cs.bgu.ac.il/~vassilii/forth-opt/Dijkstra_8java-source.html
Dijkstra.java Go to the documentation of this file.
00001 // $Header: /home/vassilii/BGU/courses/fp042/forth-opt/RCS/Dijkstra.java,v 2.0 2004/09/05 00002
00003 import java.util.*;
00004
00005 public class Dijkstra implements PathFinder {
00006
00007 public Iterator findShortestPath(Vertex source, Vertex destination) {
00008 Map s = new HashMap();
00009
PriorityQueueSet q = new PriorityQueueSet();
00010 q.
enqueue(source, 0, null);
00011
00012 while (!q.
isEmpty()) {
00013 //u <- extract-min(q)
00014
Element u = q.dequeue();
00015 if (u.
vertex.equals(destination)) return extractPath(u, s);
00016 // s <- s U {u}
00017 s.put(u.
vertex, u);
00018 for (Iterator iter = u.
vertex.outgoingEdges(destination); iter.hasNext();) {
00019 Edge e = (Edge) iter.next();
00020 Vertex v = e.destination();
00021 if (!s.containsKey(v))
00022 q.
enqueue(v, u.distance + e.weight(), e);
00023 }
00024 }
00025 return new ArrayList().iterator(); // empty for no path found
00026 }
00027
00028 static private Iterator extractPath(Element elm, Map s) {
00029 LinkedList l = new LinkedList();
00030
00031 for (Edge e = elm.
previous; e != null; e = ((Element)s.get(e.source())).previous)
00032 l.addFirst(e);
00033 return l.iterator();
00034 }
00035
00036 static class PriorityQueueSet {
00037 SortedSet q = new TreeSet();
00038 Map lookUp = new HashMap();
00039
00044 public void enqueue(Vertex v, int d, Edge e) {
00045 if (!
lookUp.containsKey(v)) {
00046
Element elm = new Element(v, d, e);
00047
lookUp.put(v, elm);
00048
q.add(elm);
00049 } else {
00050
Element elm = (Element)lookUp.get(v);
00051 if (elm.
distance > d) {
00052
q.remove(elm);
00053 elm.
distance = d;
00054 elm.
previous = e;
00055
q.add(elm);
00056 }
00057 }
00058 }
00059
00064 public Element dequeue() {
00065 if (
q.isEmpty()) return null;
00066
Element elm = (Element)q.first();
00067
q.remove(elm);
00068
lookUp.remove(elm.vertex);
00069 return elm;
00070 }
00071
00072 public boolean isEmpty() { return q.isEmpty(); }
00073
00074 public String toString() { return q.toString(); }
00075 }
00076
00077 static class Element implements Comparable {
00078 final Vertex vertex;
00079 int distance;
00080 Edge previous;
00081
00082 public Element(Vertex v, int d, Edge e) {
00083 this.vertex = v;
00084 this.distance = d;
00085 this.previous = e;
00086 }
00087
00088 public int compareTo(Object o) {
00089
Element k = (Element)o;
00090 if (k.
distance == this.distance)
00091 return this.vertex.compareTo(k.
vertex);
00092 else
00093 return this.distance - k.
distance;
00094 }
00095
00096 public boolean equals(Object o) {
00097
Element k = (Element)o;
00098 return this.distance == k.
distance && this.vertex.equals(k.vertex);
00099 }
00100
00101 public String toString() {
00102 return "["+
vertex+","+distance+","+previous+"]";
00103 }
00104 }
00105 }
Generated on Tue Sep 21 21:39:11 2004 for FORTH stack optimization by
1.3.8

Monday, August 18, 2008

Graph

带权路径长度最短-最优二叉树

回路 简单路径 简单回路 连通 连通图 连通分量-图中最大的连通子图 无向图


强连通图 强连通分量 有向图

有根的图 图的根 边带权的图为网络 无向网络 有向网络

图的存储

1.邻接矩阵

n个顶点的图 A[i,j]=1 i->j 有边; 0 i->j 无边

n个顶点的网络 wij,0(i=j),无穷

邻接矩阵只表示顶点之间的关系,使用顺序表存储图中顶点数值(顶点表)

2.邻接表

顶点表(n个元素)的顺序表(每个元素至少应包含一个指针字段first,用来指向每个链表的第一个结点)+

图的存储算法:

//顶点表中元素类型

struct node{

int degree;//顶点的度

arcnode *first ;//链表的首指针

}

struct arcnode{

int vertext; //相邻的顶点字号

int weight ;//边的权值

arcnode * next ;//指向链表的下一个结点

}

node adjlist[n0+1];//顶点表

int n ;//图的顶点数

void setgraph(){


int i,j,w;

//init

cin>>n;

for(int i=1;i<=n;i++){

adjlist[i].degree = 0;

adjlist[i].first = NULL;

}


//读入第一条边

cin>>i>>j>>w;

while((i>=1)&&(i<=n)){

//存入邻接表

p=adjlist[i].first;

while((p!=NULL)&&(p->vertext!=j)){

p=p->next;

}

if(p==NULL){

p = new arcnode;

p->vertext=j;

p->weight = w;

p->next=adjlist[i].first;

adjlist[i].first = p ;

++(adjlist[j].degree);

}

cin>>i>>j>>w;//读入下一条边

}


}

遍历:

1.深度遍历 2.广度遍历

定义一个顶点是否被访问过的标记数组 mark[i]

深度遍历的特点"后进先出" -使用栈

广度遍历的特点"先进先出"-使用队列

深度遍历算法:

void deeptrarverse(int x){

int mark[n0+1] , k;

int s[n0+1],t;

arcnode *p;

for(k=1;k<=n;k++) mark[k]=0;

cout<

mark[x]=1;

t=1;s[t]=x;//将深度经过的结点压入栈中

do{

k=s[t];//始终对栈顶元素进行操作

p=adjlist[k].first;//临时的首指针

while(p&&mark[p->vertex]){

p=p->next;//存在和栈顶元素的链接,但已被访问过,向下遍历查找无访问过的结点

}

if(p==NULL){

t--;//邻接的结点全部访问过则弹出栈顶元素

}else{

x=p->vertex;//未访问过则进行访问并把它置于栈顶重复上面操作

cout<

mark[x]=1;

s[++t]=x;

}

}while(t)//栈空结束

}

广度遍历:

void widetraverse(int x){

int q[n0+1],f=1,r=2;

cout<

q[1]=x;

arcnode * p ;

for( int k=0;k

mark[x]=1;

do{

k=q[f++];

p=adjlist[k].first;

while(p){//如果x的邻接结点未访问,一次访问全部的邻接结点放入队尾

if(mark[p->vertex]==0){

cout<vertex<<" ";

mark[p->vertex]=1;

q[r++]=p->vertex;

}

p=p->next;

}

}while(f!=r)

}

图的生成树

深度优先生成树 广度优先生成树

最小生成树 最短路径

在无回路的有向网络中,假设只有一个入度为0的顶点(源点)和一个出度为0的点(汇点) ,之间最长的路径为关键路径

单源最短路径问题:


Dijkstra 基本思想

算法基本思想  设S为最短距离已确定的顶点集(看作红点集),V-S是最短距离尚未确定的顶点集(看作蓝点集)。①初始化  初始化时,只有源点s的最短距离是已知的(SD(s)=0),故红点集S={s},蓝点集为空。②重复以下工作,按路径长度递增次序产生各顶点最短路径  在当前蓝点集中选择一个最短距离最小的蓝点来扩充红点集,以保证算法按路径长度递增的次序产生各顶点的最短路径。  当蓝点集中仅剩下最短距离为∞的蓝点,或者所有蓝点已扩充到红点集时,s到所有顶点的最短路径就求出来了。 注意:  ①若从源点到蓝点的路径不存在,则可假设该蓝点的最短路径是一条长度为无穷大的虚拟路径。  ②从源点s到终点v的最短路径简称为v的最短路径;s到v的最短路径长度简称为v的最短距离,并记为SD(v)。
(3)在蓝点集中选择一个最短距离最小的蓝点k来扩充红点集  根据按长度递增序产生最短路径的思想,当前最短距离最小的蓝点k的最短路径是:  源点,红点1,红点2,…,红点n,蓝点k 距离为:源点到红点n最短距离+<红点n,蓝点k>边长  为求解方便,设置一个向量D[0..n-1],对于每个蓝点v∈ V-S,用D[v]记录从源点s到达v且除v外中间不经过任何蓝点(若有中间点,则必为红点)的"最短"路径长度(简称估计距离)。  若k是蓝点集中估计距离最小的顶点,则k的估计距离就是最短距离,即若D[k]=min{D[i] i∈V-S},则D[k]=SD(k)。  初始时,每个蓝点v的D[c]值应为权w,且从s到v的路径上没有中间点,因为该路径仅含一条边。 注意:  在蓝点集中选择一个最短距离最小的蓝点k来扩充红点集是Dijkstra算法的关键
(4)k扩充红点集s后,蓝点集估计距离的修改  将k扩充到红点后,剩余蓝点集的估计距离可能由于增加了新红点k而减小,此时必须调整相应蓝点的估计距离。  对于任意的蓝点j,若k由蓝变红后使D[j]变小,则必定是由于存在一条从s到j且包含新红点k的更短路径:P=。且D[j]减小的新路径P只可能是由于路径和边组成。  所以,当length(P)=D[k]+w小于D[j]时,应该用P的长度来修改D[j]的值。
(5)Dijkstra算法
Dijkstra(G,D,s){ //用Dijkstra算法求有向网G的源点s到各顶点的最短路径长度
//以下是初始化操作
S={s};D[s]=0; //设置初始的红点集及最短距离
for( all i∈ V-S )do //对蓝点集中每个顶点i
D[i]=G[s][i]; //设置i初始的估计距离为w
//以下是扩充红点集
for(i=0;i
/最多扩充n-1个蓝点到红点集
D[k]=min{D[i]:all i V-S};
//在当前蓝点集中选估计距离最小的顶点k
if(D[k]等于∞) return;
//蓝点集中所有蓝点的估计距离均为∞时,
//表示这些顶点的最短路径不存在。
S=S∪{k}; //将蓝点k涂红后扩充到红点集
for( all j∈V-S )do //调整剩余蓝点的估计距离
if(D[j]>D[k]+G[k][j])
//新红点k使原D[j]值变小时,用新路径的长度修改D[j],
//使j离s更近。
D[j]=D[k]+G[k][j]; }
}

Sunday, August 17, 2008

栈和队列

栈先进后出 队列 先进先出

1.顺序栈

struct stack{

datatype s[n0+1];

int t ;

}


void push(stack & L, datatype x){

if(L.t==n0){

cout<<"栈满";

else

L.s[++L.t]=x;

}

}


void pop(stack & L){

if(L.t==0)

cout<<"empty";

else

L.t--;

}

2.链接栈

struct node{

datatype data ;

node * next ;

}//t是栈顶指针

void push(node * &t,datatype x){

node * p;

p = new node ;

p->next=t;

p->data=x;

t=p;

}

void pop (node * & t){

node * p;

if(t==NULL)

cout<<"栈空";

else {

p=t;

t=t->next;

delete p;

}

}

表达式求值:

数字串转换为整数值

v=0;

do{

v = 10 * v + c-'0';

cin>>c;

}while((c>='0')&&(c<='9'))

顺序队列

队列中最多容纳n0个元素 插入新元素之前,若出现(r+1)mod(n0+1)等于f则说明队列已满,若在删除操作之前,若出现f等于r,则说明队列已空,不能删除。

队列中元素个数为n=(rear-front+n0+1)mod(n0+1)

插入:

struct queue{

datatype q[n0+1];

int f,r;

}

void enq(queue & qu,datatype x){

if((qu.r+1)%(n0+1)==qu.f)){

cout<<"已满";

}

else{

qu.q[qu.r]=x;

qu.r=(qu.r+1)%(n0+1);

}

}

删除 qu.f=(qu.f+1)%(n0+1)

线性表

顺序表

#define n0 100

#define datatype int

struct sqlist{

datatype[n0+1];

int n;

}

插入的平均移动次数n/2,删除的平均移动次数n-1/2 执行时间O(n)

约瑟夫问题:每次有一位出列后,后面的元素都向左移动一位,列长减一

下次出列的位置=[上次出列的位置+m值(循环次数)-1]mod 当前列长i

线性链表:链接方法存储的线性表称为线性链表,简称链表

单向链表中表头结点简化插入删除操作,不修改表头指针。

循环单向链表:最后一个结点的指针字段存入第一个结点或表头结点的地址,可以立即访问到链表的最后一个结点。便于链表的首位相连的合并操作。

两种描述链表的方法:1.利用数组类型构成静态链表 2.利用指针类型构成动态链表

#define datatype int

struct node{

datatype data;

node * next ;

}

stuct linklist{

node *head ;//表头指针

int n ; //线性表长度

}

定位:第i个结点,若存在则返回该结点的地址 node * loc(linklist L,int i);,否则返回表头结点

p=L.head;j=0;

if((i>=1)&&(i<=L.n))

while(j

p=p->next;

j++;

}

return p;

插入:void( linklist & L,int i,datatype x){

node * p, *q;

p=loc(L,i);

q=new node;

q->data = x;

q->next=p->next;

p->next=q;

L.n++;

}

双向链表

插入新结点

q->prior = p ;

q->next = p->next;

p->next = q ;

q->next->prior=q;

删除结点

p->prior->next=p->next;

p->next->prior=p->prior;

静态链表

#define n0 100

#define datatype char

struct element{

datatype data;

int next ;//指针字段

}

element S[n0+1];//链表存储空间

int head ;//表头指针


多项式相加问题

Thursday, August 14, 2008

#ifdef作用

pre processor command
a.prevent multiple definitions
b.hide the differences between systems
c.Turn debugging code off and on
Ascii A -65 Z-90 a-91
#ifdef
#else
#endif

Wednesday, August 13, 2008

Resume Letter Writing

For a resume to be truly outstanding, it needs to highlight your unique strenghts and be custom tailored to the targeting 0poistion.



1.how to analyze the job description


read job descriptions and highlight the required and preferred skills , abilities, attributes and qualification. use these words in resume.



2.create a list of accomplishments



take some time to think about tasks that you enjoyed doing ,did well,and of which you were proud.Include education /training,volunteer experience,jobs,projects,school assignments,travel,and group/team activities.Quantify the results , if possible , use commonly understood terminology.Don't be humble. This is an better chance to promote oneself.






Resume Format:



chronological:Most on-campus recruiters and business employers prefer a chronological resume.



skills:Using headings that reflect skills, this resume highlights your most important skill areas and knowledge relevant to a given position. This format focuses less on where and when you obtained and usedskills, and lists job titles, employers, and dates of employment in a brief section at the bottom of the page. It works well when your work experience is not directly related to your career goal or when you are making a career change.



Hybrid Chronological/Skills



3. Analyze experiences forrelevant skill areas


Reviewing each experience, identify the skills you used that fit with positions for which you are applying.



4. Write descriptive phrases


Using action verbs , write short phrases to describe what you didthat illustrates each skill. Be concise and specific. Arrange the descriptive phrases in order of relevance to the position for which you are applying (most relevant at the top)




SENDING RESUMES AND LETTERS ELECTRONICALLY


Give the document a name the hiringmanager will associate with you,such as “MillerJennifer.doc. ”This willenable a recruiter to fi nd your resumeonce it’s saved on a computer. Don’tname the document “Resume.doc.”


Verbs List

attained improved increased strengthened convinced operated upgraded founded initiated introduced invented originated revitalized expedited achieved expanded improved pioneered reduced resolved restored spearheaded transformed