数据结构
糖心馒头
不想敲代码的孩子都不是好孩子
展开
-
青蛙(frog)杯第一届棒球比赛开赛啦。 你现在是一名记分员,输入一个字符串数组(比赛记录情况),按如下规则计分: 1. 如果该字符串是数字:代表当轮比赛的得分情况。 2. 如果该字符串是“+”:
#include "stdafx.h"#include<stack>#include<vector>#include<iostream>using namespace std;int frogPoints(char *str,int length){ stack <int>stk; int sumScore=0;//总分 int temp;//暂时...原创 2018-05-08 21:36:14 · 652 阅读 · 0 评论 -
求二叉树的结点个数
求二叉树的结点个数,如果根节点为空,则返回 0。 #include<iostream>#include <malloc.h>using namespace std;static int D = 0;//记录具有两个子女结点的结点个数//定义二叉树结构typedef struct Bintreenode { char data; struct Bintreenod...原创 2018-05-09 21:10:57 · 6723 阅读 · 2 评论 -
两个有序的无头结点的链表的交并集的实现
#include "stdafx.h"#include<iostream>using namespace std;typedef struct LNode{ int data; struct LNode *next; LNode(const int &d) :data(d), next(NULL) {}}LNode,*ListNode;void CreatLi...原创 2018-05-07 22:04:45 · 401 阅读 · 0 评论