ITfeng

 

2012年4月21日

链表实现队列

摘要: 插入队列时,注意判断队列是否为空出队列时,注意判断:1 队列是否为空 2 是否是最后一个元素出队列 3 正常出队列#include<stdio.h>#include<stdlib.h>typedef struct list{int data;struct list*next;}List;typedef struct queue{List*front;List*rear;}Queue;void init_queue(Queue*q){q->front=q->rear=NULL;}void inqueue(Queue *q,int data){List*newn 阅读全文

posted @ 2012-04-21 23:23 ITfeng 阅读(238) 评论(0) 推荐(0) 编辑

用栈实现队列

摘要: #include<stdio.h>#include<stdlib.h>typedef struct list{int data;struct list*next;}List;typedef struct stack{List*top;}Stack;Stack*A;Stack*B;void init_stack(Stack*s){s->top=NULL;}void push_stack(Stack*s,int data){List*newnode=(List*)malloc(sizeof(List));newnode->data=data;newnode-&g 阅读全文

posted @ 2012-04-21 22:13 ITfeng 阅读(178) 评论(0) 推荐(0) 编辑

栈的应用-括号匹配

摘要: #include<stdio.h>#include<stdlib.h>#define N 100typedef struct stack{char store[N];int top;}Stack;void init_stack(Stack *s);void push_stack(Stack *s,char data);char pop_stack(Stack *s);int match(char x, char y);int main(){char *table;int flag=1;Stack*s=(Stack*)malloc(sizeof(Stack));init_ 阅读全文

posted @ 2012-04-21 21:28 ITfeng 阅读(184) 评论(0) 推荐(0) 编辑

单链表转成双向循环链表

摘要: #include<stdio.h>#include<stdlib.h>struct node{int data;struct node*next;};struct Binode{int data;struct Binode*next;struct Binode*prev;};struct Binode*func(struct node*head);int main(){//新建衣蛾单链表struct node*head=NULL;struct node*temp;struct node*newnode;struct Binode*Bihead=NULL;struct B 阅读全文

posted @ 2012-04-21 19:58 ITfeng 阅读(759) 评论(0) 推荐(0) 编辑

大华面试总结

摘要: 今天去面试,笔试部分出了三道题,第一题是文件的打包;第二个是两个大数相乘;第三题是单链表改成循环链表第三题算是做出来了,但是前面两题没有想法。尽管才做出一题,但是还是参加了第二轮面试。考官第一问:进程和线程的区别,答对了第二问:线程中栈和堆的区别我说不知道,不过现在想来老师讲过,malloc开辟的空间在堆区;临时变量在栈区第三问:考官还算好,再问那么堆和栈,临时变量在那个区我脑子一片糊涂,马上说堆区,考官说今天的面试结束。就这样被咔嚓掉了。我总结我今天失败的原因:1回答问题没有三思而后行,回答不经脑子,其实这个问题答案我是知道的2 不懂装懂,这也许是考官最痛恨的,也许我说不知道会比我说在堆区更 阅读全文

posted @ 2012-04-21 16:14 ITfeng 阅读(981) 评论(0) 推荐(0) 编辑

导航