2020/6/28 高阶求导(泰勒公式专题)/栈
| 科目 | 内容 | 补充 | 时间 |
|---|---|---|---|
| 数学 | 高阶求导(专题7 泰勒公式应用 看到01:06:12) |
常用n阶导公式

常见泰勒级数展开公式

常用泰勒公式

将一个带头结点的单链表A分解为两个带头节点的单链表A和B,使得A表中含有原表中序号为奇数的元素,而B表中含有原表中序号为偶数的元素,且保持其相对顺序不变。
#include
#include
#include
typedef struct LNode
{int data;struct LNode *next;
} LNode, *LinkList;bool InitList(LinkList &L)
{L = NULL;return true;
}LinkList List_TailInsert(LinkList &L)
{int x;L = (LNode *)malloc(sizeof(LNode));L->next = NULL;LNode *s, *r = L;scanf("%d", &x);while (x != 9999){s = (LNode *)malloc(sizeof(LNode));s->data = x;r->next = s;r = s;scanf("%d", &x);}r->next = NULL;return L;
}
void printlist(LinkList L)
{LNode *t;t = L->next;while (t != NULL){printf("%d", t->data);t = t->next;}
}void disintegrate(LinkList &A, LinkList NewA, LinkList NewB) //将单链表A中的节点分为两个带头结点的单链表A和B,A中含有原表中序号为奇数的元素,B中含有原表序号偶数的元素,且保持相对顺序不变
{LNode *p; //LNode *ra, *rb;int i = 0;p = A->next;A->next = NULL;ra = NewA;rb = NewB;while (p != NULL){i++;if (i % 2 == 0){rb->next = p;rb = rb->next;}else{ra->next = p;ra = ra->next;}p = p->next;}ra->next = NULL;rb->next = NULL;}int main(void)
{LNode *A, *NewA, *NewB;NewA = (LNode *)malloc(sizeof(LNode));NewA->next = NULL;NewB = (LNode *)malloc(sizeof(LNode));NewB->next = NULL;InitList(A);printf("set:");List_TailInsert(A);printlist(A);printf("\n_________________\n");disintegrate(A,NewA,NewB);printlist(NewA);printf("\n_______________\n");printlist(NewB);return 0;
}
#include
#include
#include
typedef struct LNode
{int data;struct LNode *next;
} LNode, *LinkList;bool InitList(LinkList &L)
{L = NULL;return true;
}LinkList List_TailInsert(LinkList &L)
{int x;L = (LNode *)malloc(sizeof(LNode));L->next = NULL;LNode *s, *r = L;scanf("%d", &x);while (x != 9999){s = (LNode *)malloc(sizeof(LNode));s->data = x;r->next = s;r = s;scanf("%d", &x);}r->next = NULL;return L;
}
void printlist(LinkList L)
{LNode *t;t = L->next;while (t != NULL){printf("%d", t->data);t = t->next;}
}void disintegrate(LinkList &A, LinkList NewA, LinkList NewB) //将单链表A中的节点分为两个带头结点的单链表A和B,A中含有原表中序号为奇数的元素,B中含有原表序号偶数的元素,且保持相对顺序不变
{LNode *p; //LNode *ra, *rb;int i = 0;p = A->next;A->next = NULL;ra = NewA;rb = NewB;while (p != NULL){i++;if (i % 2 == 0){rb->next = p;rb = rb->next;}else{ra->next = p;ra = ra->next;}p = p->next;}ra->next = NULL;rb->next = NULL;}int main(void)
{LNode *A, *NewA, *NewB;NewA = (LNode *)malloc(sizeof(LNode));NewA->next = NULL;NewB = (LNode *)malloc(sizeof(LNode));NewB->next = NULL;InitList(A);printf("set:");List_TailInsert(A);printlist(A);printf("\n_________________\n");disintegrate(A,NewA,NewB);printlist(NewA);printf("\n_______________\n");printlist(NewB);return 0;
}
栈
#define MaxSize 10 //元素最大个数
typedef struct
{int data[MaxSize];int top;
} SqStack;
//初始化栈
void InitStack(SqStack &S)
{S.top = -1;
}//判断栈空
bool StackEmpty(SqStack S)
{if (S.top == -1)return true;elsereturn false;
}
//新元素入栈
bool Push(SqStack &S,int x)
void testStack()
{SqStack S;InitStack(S);
}
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
