自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(10)
  • 收藏
  • 关注

原创 利用栈计算中缀表达式

#include #include<math.h>using namespace std;#define MIN 0.00000001int getpriority(char op){if(op==’+’||op==’-’){return 0;}else{return 1;}}int caltwonums(float opnd1,float opnd2,char op,float &result){if(op==’+’){result=(opnd1+op

2021-07-24 00:48:17 210

原创 利用栈实现中缀表达式转换为前缀表达式,无视我的垃圾注释

void infixtoprefix(char infix[],char s2[],char &top2,int len)//infix为中缀表达式,s2可以保存最终结果{ //top2为结果栈的栈顶指针int maxsize;char s1[maxsize]; //s1为中转栈int top1= -1;int i =len -1;while(infix[i]!= ‘\0’){

2021-07-22 19:06:29 264

原创 利用栈实现中缀表达式转为后缀表达式

#include using namespace std;void infixtopostfix(char infix[],char s2[],char &top2)//infix为中缀表达式,s2可以保存最终结果{ //top2为结果栈的栈顶指针int maxsize;char s1[maxsize]; //s1为中转栈int top1= -1;int i =0;while(

2021-07-22 19:01:04 334

原创 单链表逆置问题

using namespace std;typedef struct SLnode{int data;struct SLnode* next;}SLnode;void crealist(SLnode &head,int a[],int n){head=(SLnode)malloc(sizeof(SLnode));SLnode *p=head;SLnode x;for(int i =0;i<n;i++){x=(SLnode)malloc(sizeof(SLnode));

2021-07-17 13:39:33 249

原创 单链表删除最小值,费了我好大劲,不过好在记住了

#include using namespace std;typedef struct SLnode{int data;struct SLnode* next;}SLnode;void crealist(SLnode &head,int a[],int n){head=(SLnode)malloc(sizeof(SLnode));SLnode *p=head;SLnode x;for(int i =0;i<n;i++){x=(SLnode)malloc(sizeof

2021-07-17 12:52:24 106

原创 递增非空链表中删除相邻相同数字

using namespace std;typedef struct node{int data;struct node *next;}node;void creatlist(node*&head,int arr[],int n){head=(node*)malloc(sizeof(node));head->next=NULL;node* p=head;for(int i=0;i<n;i++){nodex=(node)malloc(sizeof(node));

2021-07-13 23:27:32 69

原创 以第一个元素进行顺序表划分

void compare(int a[],int n){int temp;int i,j;temp=a[0];i=0;j=n-1;while(i<j){while(i<j&&a[j]>temp){j–;}if(a[j]<temp){a[i]=a[j];i++; } while(a[i]<temp&&i<j) { i++; }

2021-07-13 22:44:04 251

原创 顺序表逆置

最简单的顺序表逆置#include using namespace std;void remake(int arr[],int n){int i,j;i=0;j=n-1;int temp;while(i<j){temp=arr[j];arr[j]=arr[i];arr[i]=temp;i++;j–;}}int main(){int a[]={1,2,3,4,5};int a1[]={1,2,3,4,5,6};int num1=5;int num2=6;r

2021-07-13 22:29:29 118

原创 2021-07-12

#include using namespace std;void part1(int arr[],int n)/part1是第一种划分方法,及以数组中的第一个数值为数轴进行划分/{int i =0;int j=n-1;int temp=arr[i];//用temp保存数轴的值while(i<j){while(i<j&&arr[j]>=temp)/此while与下面的while用来驱使i,j分别向右和向左//对于j,当找到比temp小的数值时,将i与j的

2021-07-12 22:15:04 84

原创 2021-07-12

作为一个从生物大坑准备跳向电子信息的考生,弄懂这点东西,而且是彻底弄懂,实在是不容易。#include using namespace std;typedef struct SLnode{int data;struct SLnode *next;}SLnode;void creatList(SLnode &head,int arr[],int n){SLnode p;SLnode r;head=(SLnode)malloc(sizeof(SLnode));head->

2021-07-12 00:03:19 61

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除