
数据结构
努力up不变菜
这个作者很懒,什么都没留下…
展开
-
数据结构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 阅读 · 0 评论 -
数据结构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 阅读 · 0 评论 -
最大子列和(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 · 1273 阅读 · 2 评论 -
单向链表逆序
循环方式实现逆转链表关于如何逆转,过程分析,可以看单链表逆序,分析的超级好!还有一篇线性结构:单向链表的逆转 也很形象直观1、单链表逆转#include <stdio.h>#include <stdlib.h>typedef int ElementType;typedef struct Node *PtrToNode;struct Node{ ...原创 2019-09-09 18:56:49 · 482 阅读 · 0 评论 -
寻找第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 阅读 · 0 评论 -
递归求简单交错幂级数的部分和
#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 · 346 阅读 · 0 评论 -
两个有序链表序列的合并
#include <stdio.h>#include <stdlib.h>/** 习题2.5 两个有序链表序列的合并 (15 分) * * L1和L2是给定的带头结点的单链表, *其结点存储的数据是递增有序的; *函数Merge要将L1和L2合并为一个非递减的整数序列。 *应直接使用原序列中的结点, *返回归并后的带头结点的链表头指针。 * */ty...原创 2019-09-14 13:46:08 · 337 阅读 · 0 评论 -
习题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 阅读 · 0 评论