练习题
文章平均质量分 63
温度的喵
你若盛开,清风自来
展开
-
练习:逻辑运算与位运算实现除法运算,加法运算
逻辑运算与位运算实现除法运算: 方案一: # include int MyDiv( int a , int b ) { printf( " a = %d b =%d \n" , a, b); int sum = 0; int c = b; if( b == 0 ) {原创 2014-04-17 22:01:45 · 896 阅读 · 0 评论 -
数据结构:二分查找的递归与非递归实现--C实现
# include # include int BenarySearch( int* a , int len ,int findData ) { if( a == NULL || len <= 0 ) { return -1; } int istart = 0; int iend = len -1; while( istart原创 2014-04-07 16:24:11 · 664 阅读 · 0 评论 -
数据结构:单链表排序--C实现
# include # include typedef struct node { int data; struct node* next; } linklist; linklist *head = NULL; linklist* CreatList( int * arr , int len ) { int data ; linklist *pCurren原创 2014-04-07 17:10:31 · 574 阅读 · 0 评论 -
练习:判断两个无环链表是否相交--C实现
//value指向交叉结点,list1,list2为需要操作的两个单向链表 bool IsIntersect( node* list1 , node* list2 , node* &value ) { value = NULL; if( list1 == NULL || list2 == null ) { return false; } no原创 2014-04-07 19:24:16 · 518 阅读 · 0 评论 -
练习:判断单链表是否为环--C实现
# include # include typedef struct node { int data ; struct node* next; }linklist; bool IsLoop( linklist* pll) { bool flag = false; linklist* fast = pll; linklist* slow = pll;原创 2014-04-07 18:12:25 · 431 阅读 · 0 评论 -
数据结构:交换单链表中的任意两元素--C实现
# include # include struct node { int data ; node * next; }; //前驱节点 node* FindPre( node* head , node* p ) { node *q = head while( q ) { if( q->next == p ) {原创 2014-04-07 17:31:32 · 899 阅读 · 0 评论