- 博客(9)
- 收藏
- 关注
原创 习题2.8 输出全排列(深搜问题)
#include <stdio.h>#include<string.h>int Mark[10];int Element[10];void dfs(int n,int pcur){ if(pcur==n){//递归出口 for(int i=0;i<n;i++){ printf("%d",Element[i]);...
2019-09-16 00:16:40
402
原创 两个有序链表序列的合并
#include <stdio.h>#include <stdlib.h>/** 习题2.5 两个有序链表序列的合并 (15 分) * * L1和L2是给定的带头结点的单链表, *其结点存储的数据是递增有序的; *函数Merge要将L1和L2合并为一个非递减的整数序列。 *应直接使用原序列中的结点, *返回归并后的带头结点的链表头指针。 * */ty...
2019-09-14 13:46:08
335
原创 递归求简单交错幂级数的部分和
#include <stdio.h>#include <stdlib.h>#include <math.h>/* 习题2.6 递归求简单交错幂级数的部分和 * * 计算下列简单交错幂级数的部分和: * * f(x,n)=x−x^2+x^3−x^4+⋯+(−1)^n−1x^n * */ double fn( double x, in...
2019-09-14 13:45:20
340
原创 寻找第K大的数
#include <stdio.h>#include <stdlib.h>#define SMaxSize 10000typedef int ElementType;typedef int Position;typedef struct Node *PtrToNode;struct Node{ ElementType Data[SMaxSize...
2019-09-11 22:22:03
518
原创 单向链表逆序
循环方式实现逆转链表关于如何逆转,过程分析,可以看单链表逆序,分析的超级好!还有一篇线性结构:单向链表的逆转 也很形象直观1、单链表逆转#include <stdio.h>#include <stdlib.h>typedef int ElementType;typedef struct Node *PtrToNode;struct Node{ ...
2019-09-09 18:56:49
481
原创 共用体
int main(){ union key{ int k; char ch[20]; }u; strcpy( u.ch, "C Programming"); printf( "u.ch : %s\n", u.ch); u.k=258; printf("%d\t%d\t%d\t",u.k,u.ch[0],u.c...
2019-09-08 16:52:35
471
原创 最大子列和(C语言+4种方法)
主函数:调用不同的函数,更改这句就OKmax=MaxSubseqSum4(A,N);int main(){ int N,A[100000],max; // printf("enter the number of the list N:\n"); scanf("%d",&N); // printf("enter the content of the lis...
2019-09-08 00:29:52
1271
1
原创 数据结构PAT 1.8 二分查找
Position BinarySearch( List L, ElementType X ){ ElementType maxindex=L->Last; ElementType minindex=1; ElementType center; while(maxindex>=minindex){ center=(maxindex+...
2019-09-07 23:51:11
246
原创 数据结构PAT 1.9 有序数组插入
浙江大学mooc数据结构PAT 1.9 有序数组插入@TOC功能快捷键撤销:Ctrl/Command + Z重做:Ctrl/Command + Y加粗:Ctrl/Command + B斜体:Ctrl/Command + I标题:Ctrl/Command + Shift + H无序列表:Ctrl/Command + Shift + U有序列表:Ctrl/Command + Shift...
2019-09-07 23:48:02
645
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人