当前位置: 首页 > news >正文

天水做网站的wordpress能不能做商城

天水做网站的,wordpress能不能做商城,个人网页设计作品简单,在wordpress加入文件管理器1判断完全二叉树递归做法 有四种情况#xff1a;1 左树完全#xff0c;右数满#xff0c;且左高为右高加一 2左满 #xff0c;右满#xff0c;左高为右高加一 3左满#xff0c;右完全#xff0c;左右高相等 4左右均满且高相等 #includeiostream #include1 左树完全右数满且左高为右高加一 2左满 右满左高为右高加一 3左满右完全左右高相等 4左右均满且高相等 #includeiostream #includealgorithm using namespace std; class TreeNode { public:int val;TreeNode* left;TreeNode* right;TreeNode(int a) :val(a), left(nullptr), right(nullptr) {}; }; struct info {int height;bool iscbt;bool isfull;info(int a,bool b,bool c):height(a),iscbt(b),isfull(c){} }; info process(TreeNode* head) {if (head nullptr)return info(0, true, true);info leftinfo process(head-left);info rightinfo process(head-right);int height max(leftinfo.height, rightinfo.height) 1;bool isfull leftinfo.isfull rightinfo.isfull leftinfo.height rightinfo.height;bool iscbt false;if (leftinfo.isfull rightinfo.isfull leftinfo.height - rightinfo.height 1)iscbt true;if (leftinfo.isfull rightinfo.isfull leftinfo.height rightinfo.height )iscbt true;if (leftinfo.iscbt rightinfo.isfull leftinfo.height - rightinfo.height 1)iscbt true;if (leftinfo.isfull rightinfo.iscbt leftinfo.height rightinfo.height)iscbt true;return info(height, iscbt, isfull); } bool iscbt(TreeNode* head) {if (head nullptr)return true;return process(head).iscbt; } 2 给定一棵二叉树的头节点head返回这颗二叉树中最大的二叉搜索子树的头节点 #include iostream #include vector #include algorithm using namespace std; class TreeNode { public:int val;TreeNode* left;TreeNode* right;TreeNode(int data) : val(data), left(nullptr), right(nullptr) {} }; struct info {TreeNode* node;//最大搜索子树头结点int maxsize;int min;int max;info(TreeNode *a,int b,int c,int d):node(a),maxsize(b),min(c),max(d){} }; info* process(TreeNode* head) {if (head nullptr)return nullptr;info* leftinfo process(head-left);info* rightinfo process(head-right);int maxval head-val;int minval head-val;TreeNode* ans nullptr;int size 0;if (leftinfo ! nullptr){maxval max(maxval, leftinfo-max);minval min(minval, leftinfo-min);ans leftinfo-node;size leftinfo-maxsize;}if (rightinfo ! nullptr){maxval max(maxval, rightinfo-max);minval min(minval, rightinfo-min);if (rightinfo-maxsize size){ans rightinfo-node;size rightinfo-maxsize;}}//当能构成搜索二叉树时if((leftinfonullptr?true:(leftinfo-nodehead-leftleftinfo-maxhead-val)) (rightinfo nullptr ? true : (rightinfo-node head-right rightinfo-min head-val))){anshead;//一定要记得判空size (leftinfo nullptr ? 0 : leftinfo-maxsize) (rightinfo nullptr ? 0 : leftinfo-maxsize) 1;}return new info(ans, size, minval, maxval); } TreeNode* maxSubBSTHead2(TreeNode* head) {if (head nullptr)return nullptr;return process(head)-node; }3给定一棵二叉树的头节点head和另外两个节点a和b返回a和b的最低公共祖先 法1用哈希表记下所有节点父节点将一个节点不停地向上这其中经过的节点放入一个集合中 再在另一个节点从上遍历一遍查找是否在集合中已经存在过找到的第一个即为答案 #include iostream #include unordered_map #include unordered_set using namespace std; class TreeNode { public:int val;TreeNode* left;TreeNode* right;TreeNode(int data) : val(data), left(nullptr), right(nullptr) {} }; void fillmap(TreeNode* head, unordered_mapTreeNode*, TreeNode* map) {if (head-left ! nullptr){map[head-left] head;fillmap(head-left, map);}if (head-right ! nullptr){map[head-right] head;fillmap(head-right, map);} } TreeNode* lowestAncestor(TreeNode* head, TreeNode* p, TreeNode* q) {if (head nullptr)return nullptr;unordered_mapTreeNode*, TreeNode* map;//记录所有节点的父节点map[head] nullptr;fillmap(head,map);unordered_setTreeNode* set;TreeNode* cur p;set.insert(cur);while (map[cur] ! nullptr){cur map[cur];set.insert(cur);}cur q;while (set.find(cur) set.end()){cur map[cur];}return cur; } 法二递归套路会聚点与x有关还是无关无关已经在左或右树右答案或这棵树a,b没找全 x是答案左发现一个右发现一个 x本身就是a然后左右发现了b   x本身就是b左右发现a #include iostream using namespace std;// 节点类 class Node { public:int value;Node* left;Node* right;Node(int data) : value(data), left(nullptr), right(nullptr) {} }; // 最低公共祖先函数 Node* lowestAncestor2(Node* head, Node* a, Node* b) {return process(head, a, b).ans; }// 信息结构体 struct Info {bool findA;bool findB;Node* ans;Info(bool fA, bool fB, Node* an) : findA(fA), findB(fB), ans(an) {} };// 处理函数 Info process(Node* x, Node* a, Node* b) {if (x nullptr) {return Info(false, false, nullptr);}Info leftInfo process(x-left, a, b);Info rightInfo process(x-right, a, b);bool findA (x a) || leftInfo.findA || rightInfo.findA;//不要忘了x本身就是a的情况bool findB (x b) || leftInfo.findB || rightInfo.findB;Node* ans nullptr;if (leftInfo.ans ! nullptr) {ans leftInfo.ans;}else if (rightInfo.ans ! nullptr) {ans rightInfo.ans;}else {if (findA findB) {ans x;}}return Info(findA, findB, ans); }4  派对的最大快乐值  员工信息的定义如下: class Employee {     public int happy; // 这名员工可以带来的快乐值     ListEmployee subordinates; // 这名员工有哪些直接下级 } 公司的每个员工都符合 Employee 类的描述。整个公司的人员结构可以看作是一棵标准的、 没有环的多叉树 树的头节点是公司唯一的老板除老板之外的每个员工都有唯一的直接上级 叶节点是没有任何下属的基层员工(subordinates列表为空)除基层员工外每个员工都有一个或多个直接下级 这个公司现在要办party你可以决定哪些员工来哪些员工不来规则 1.如果某个员工来了那么这个员工的所有直接下级都不能来 2.派对的整体快乐值是所有到场员工快乐值的累加 3.你的目标是让派对的整体快乐值尽量大 给定一棵多叉树的头节点boss请返回派对的最大快乐值。 分情况:x来,x不来定义一个结构体保存两个值x来时候的最大值x不来时候的最大值 #includeiostream #includealgorithm #includevector using namespace std; struct employee {int happy;vectoremployee* nexts;employee(int h):happy(h),nexts(){} }; struct info {int yes;int no;info(int a,int b):yes(a),no(b){} }; info process(employee* head) {if (head nullptr)return info(0, 0);int yes head-happy;int no 0;for (employee* a : head-nexts){info nextinfo process(a);yes nextinfo.no;no max(nextinfo.yes, nextinfo.no);}return info(yes, no); } int maxhappy(employee* head) {info allinfo process(head);return max(allinfo.no, allinfo.yes); } 5给定一个由字符串组成的数组strs必须把所有的字符串拼接起来返回所有可能的拼接结果中字典序最小的结果 贪心局部最小得全体最优解有时候可能会有错 字典序字符串排大小长度一样比数字大小 长度不同较短的补上最小的阿斯克码值然后与长的比较 证明过程得先证明排序过程具有传递性 像石头剪刀布就没有传递性 #include iostream #include vector #include algorithm using namespace std; class compare { public:bool operator()(string a, string b){return (a b) (b a);} }; string lowestString(vectorstring str) {if (str.empty())return ;sort(str.begin(), str.end(), compare());string a;for (string c : str){a c;}return a; }
http://www.pierceye.com/news/286299/

相关文章:

  • 沙田镇仿做网站网站加速器quickq
  • 武进网站建设医药公司网站建设
  • 专业做网站建设广告设计网站素材
  • 成都建设银行保安招聘网站深圳做兼职的网站设计
  • 做网站如何找广告商湖南网站建设kaodezhu
  • 宁波专业的网站搭建公司天津网站建设技术托管
  • 做水果网站特点分析报告怎样在百度上注册自己的公司
  • 800元五合一建站上海企业排行榜
  • 学校建设网站前的市场分析上海到北京火车时刻表查询
  • 科技企业网站设计网站开发费如何入账
  • 网站主体必须要与域名注册人相同网页设计尺寸标准
  • wordpress建淘宝客网站吗网站建设与维护技术浅谈论文
  • 网站建设 技术方案网站建设的指导书
  • ps网站首页怎么做google 浏览器
  • 网站建设数据库软件制作公司宣传片哪家好
  • 高端建站模版大兴模版网站建设哪家好
  • 帝国cms怎样做网站迁移西安网站设计公司排名
  • 网站建设三折页做僾网站
  • 长沙的网站建设公司上海做网站的哪家好
  • 网站开发做什么网站建设银行北京冬奥会纪念币发行时间
  • 企业怎么建设网站网站建设与管理计划
  • 域名怎么制作网站旅游线路设计方案模板
  • 专门做mmd的网站wordpress 免费商城
  • 简洁大气国内企业网站房产网签备案是什么意思
  • 海东企业网站建设公司佛山搜索引擎推广服务好
  • 建设电子商务网站策划书开发网站开发
  • 创建个人网站的流程沈阳德泰诺网站建设
  • 网站备案 接口开一个网站多少钱
  • 郑州网站制作公司哪家好公司网页怎么设计
  • 如何做好企业网站建设工作公众微信网站建设