2020/6/28 高阶求导(泰勒公式专题)/栈

科目内容补充时间
数学高阶求导(专题7 泰勒公式应用 看到01:06:12)

常用n阶导公式
在这里插入图片描述
常见泰勒级数展开公式
在这里插入图片描述
常用泰勒公式
在这里插入图片描述
将一个带头结点的单链表A分解为两个带头节点的单链表A和B,使得A表中含有原表中序号为奇数的元素,而B表中含有原表中序号为偶数的元素,且保持其相对顺序不变。

#include <malloc.h>
#include <stddef.h>
#include <stdio.h>
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 <malloc.h>
#include <stddef.h>
#include <stdio.h>
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;
    else
        return false;
}
//新元素入栈
bool Push(SqStack &S,int x)
void testStack()
{
    SqStack S;
    InitStack(S);
}
  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值