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

找关键词的网站wordpress自定义登录地址

找关键词的网站,wordpress自定义登录地址,wordpress绝对域名更改,怎么做好推广Topic 1#xff1a;LeetCode——203. 移除链表元素203. 移除链表元素 - 力扣#xff08;LeetCode#xff09;移除链表中的数字6操作很简单#xff0c;我们只需要把2的指向地址修改就好了#xff0c;原来的指向地址是6现在改为3这个思路是完全正确的#xff0c;但是在链表…Topic 1LeetCode——203. 移除链表元素203. 移除链表元素 - 力扣LeetCode移除链表中的数字6操作很简单我们只需要把2的指向地址修改就好了原来的指向地址是6现在改为3这个思路是完全正确的但是在链表中增加或删除元素是很麻烦的我们需要判断前后是否为空指针情况很多。我们利用这个思路可以推广另外的做法把不是6的元素尾插到一个新链表这样就可以去除所有6/*** Definition for singly-linked list.* struct ListNode {* int val;* struct ListNode *next;* };*/struct ListNode* removeElements(struct ListNode* head, int val) {if(headNULL){return NULL;}struct ListNode* cur head;//利用另外的变量遍历//哨兵防止空指针struct ListNode* newnode(struct ListNode*)malloc(sizeof(struct ListNode));newnode-nextNULL;struct ListNode* tailnewnode;//记录下次尾插的作用while(cur){if(cur-val!val){tail-nextcur;//尾插到哨兵后面tailtail-next;//尾向后curcur-next;//指针向后}else{struct ListNode* tmpcur-next;//存下一个我们释放当前位置free(cur);curtmp;}}tail-nextNULL;//到尾了headnewnode-next;//去除哨兵free(newnode);return head;}Topic 2LeetCode——876. 链表的中间结点876. 链表的中间结点 - 力扣LeetCode找中间很简单但是假如我们要求时间复杂度为O(N)我们应该怎么去做小明一次走一步小华一次走两步当小华走完全程的时候小明走的路程刚刚好是全部路程的一半。通过这个例子我们可以明白我们可以定义两个指针来进行查找中间的节点。这种方法叫做快慢指针。/*** Definition for singly-linked list.* struct ListNode {* int val;* struct ListNode *next;* };*/struct ListNode* middleNode(struct ListNode* head) {struct ListNode* fasthead;struct ListNode* slowhead;while(fast fast-next)//当元素是奇数个时fast-next为NULL;当元素为偶数个fast为NULL是结束标志{fastfast-next-next;slowslow-next;}return slow; }Topic 3链表中倒数第k个结点链表中倒数第k个结点_牛客题霸_牛客网 (nowcoder.com)链表的倒数第k个元素我们先处理极端情况链表为空的时候k大于链表元素个数把极端情况处理完我们思考当时间复杂度为O(N)时我们应该怎么样得到倒数第k的节点。倒数第k个就是正数的第n-k个我们定义两个指针一个先走k步然后两个指针同时走当先走k步的指针到结尾的时候我们第二个指针就是走到了n-k的位置。/*** struct ListNode {* int val;* struct ListNode *next;* };*//*** * param pListHead ListNode类 * param k int整型 * return ListNode类*/ struct ListNode* FindKthToTail(struct ListNode* pListHead, int k ) {struct ListNode* fastpListHead;struct ListNode* slowpListHead;if(pListHeadNULL){return NULL;}while(k--)//先走k步{if(fastNULL)//链表的元素小于k{return NULL;}fastfast-next;}while(fast){fastfast-next;slowslow-next;}return slow;}Topic 4链表分割我们先解读题目给一个链表给定一个值x大于x的放后面小于x的放前面。不改变原来的数据顺序即原来小于x的值是4 2 1我们不改变想对位置 4 2 1.题目理解清楚了我们怎么做呢我们创建两个链表一个存小于x的值一个存大于等于x的值然后连接起来这样他们的相对位置就没有改变。/* struct ListNode {int val;struct ListNode *next;ListNode(int x) : val(x), next(NULL) {} };*/ class Partition { public:ListNode* partition(ListNode* pHead, int x){struct ListNode* gguard;//存大于等于x的数据得哨兵struct ListNode* lguard;//存小于x的哨兵struct ListNode* gtail;//存大于x的尾struct ListNode* ltail;//存小于x的尾struct ListNode* curpHead;gguardgtail(struct ListNode*)malloc(sizeof(struct ListNode));//申请哨兵lguardltail(struct ListNode*)malloc(sizeof(struct ListNode));//申请哨兵gtail-nextltail-nextNULL;//哨兵后面一个置空while(cur){if(cur-valx){gtail-nextcur;//哨兵后面接插入的链表gtailgtail-next;//尾向后移}else{ltail-nextcur;ltailltail-next;}curcur-next;}ltail-nextgguard-next;//连接两个链表gtail-nextNULL;//新链表的最后要置空pHeadlguard-next;free(lguard);free(gguard);return pHead;} };Topic 5 反转链表206. 反转链表 - 力扣LeetCode反转链表我们可以利用头插的思路即我们建立一个新的链表把一个一个元素头插到第一个最后插入的元素就是新的头第一个插入的元素就是新的尾。头插最最要的是更新新的头新的头就是新插入的元素的地址。/*** Definition for singly-linked list.* struct ListNode {* int val;* struct ListNode *next;* };*/struct ListNode* reverseList(struct ListNode* head) {if(headNULL){return NULL; }struct ListNode* curhead;struct ListNode* newnodeNULL;while(cur){struct ListNode* nextcur-next;//存下一个防止找不到cur-nextnewnode;//将链表第一个元素指向newnode指针下面依次指向newnodecur;//更新newnode让newnode一直指向链表的开头curnext;//链表向后移}return newnode;}Topic 6链表的回文结构链表的回文结构_牛客题霸_牛客网 (nowcoder.com)链表的回文怎么判断。我们最直接的方法是找到中间节点反转中间节点得到翻转的链表与前半段链表比较。如果前半段链表与后半段链表翻转后的元素都相等说明这个链表是回文链表。/* struct ListNode {int val;struct ListNode *next;ListNode(int x) : val(x), next(NULL) {} };*/struct ListNode* reverseList(struct ListNode* head) {if(headNULL){return NULL;}struct ListNode* curhead;struct ListNode* newnodeNULL;while(cur){struct ListNode* nextcur-next;cur-nextnewnode;newnodecur;curnext;}return newnode;}struct ListNode* middleNode(struct ListNode* head) {struct ListNode* fasthead;struct ListNode* slowhead;while(fast fast-next)//当元素是奇数个时fast-next为NULL;当元素为偶数个fast为NULL是结束标志{fastfast-next-next;slowslow-next;}return slow; }class PalindromeList { public:bool chkPalindrome(ListNode* head) {struct ListNode* midmiddleNode(head);//找到中间节点struct ListNode* rheadreverseList(mid);//反转中间节点后的元素while(rhead){if(head-valrhead-val){headhead-next;rheadrhead-next;}else{return false;//不相等说明不是回文}}return true;} };Topic 7相交链表160. 相交链表 - 力扣LeetCode怎么判断链表相交我们需要看链表的地址是否有相等的如果我们利用两个for循环来实现判断是否有相等的地址我们的时间复杂度就是O(N^2),,这个时间复杂度是很大的。我们还能通过什么方法来判断呢相交的链表有共同的特点就是它们有共同的尾我们只需要判断尾的地址是否相等就好如果尾的地址相等我们就说明它们是相交的链表。相交的链表如何寻找第一个交点全部遍历一遍这个好像不太可能。既然链表有交点第一个交点到链表尾的距离相等而头到链表交点的距离就不一定相等了它们的差值刚刚好是两个链表距离的差值。我们让长链表先走它们的差值然后一起走等它们的地址相等的时候就是它们的第一个交点。/*** Definition for singly-linked list.* struct ListNode {* int val;* struct ListNode *next;* };*/ struct ListNode *getIntersectionNode(struct ListNode *headA, struct ListNode *headB) {struct ListNode* cur1headA;struct ListNode* cur2headB;int n11;//赋值1是因为统计链表长度的时候我们的最后的一个位置我们统计到int n21;while(cur1-next)//找headA的尾{cur1cur1-next;n1;}while(cur2-next)//找headB的尾{cur2cur2-next;n2;}if(cur1!cur2){return NULL;}int difabs(n1-n2);//让长的先走cur1headA;cur2headB;if(n1n2){while(dif){cur1cur1-next;dif--;}}else{while(dif){cur2cur2-next;dif--;}}while(cur1!cur2){cur1cur1-next;cur2cur2-next;}return cur1;}
http://www.w-s-a.com/news/683902/

相关文章:

  • 手机企业网站制作流程3d建模自学
  • 网站优化方案和实施wordpress的归档
  • 建设事业单位网站多少钱集艾设计公司官网
  • 网站建设与管理方案书图片的制作方法
  • 中文建网站美发网站模板带手机版
  • 免费聊天不充值软件windows优化大师下载安装
  • 网站优化的关键词自己怎么做外贸网站空间
  • 现在建设的网站有什么劣势温州互联网公司
  • 重庆自助企业建站模板淘宝关键词top排行榜
  • 平邑网站制作买高端品牌网站
  • 深圳建网站三千网站安全代维
  • 西宁市精神文明建设网站装饰设计甲级资质
  • 做教育行业营销类型的网站徐州做网站多少钱
  • 临沂品牌网站制作企业网站建设搜集资料
  • wordpress注册验证码手机网站优化
  • 往建设厅网站上传东西做衣服的教程网站有哪些
  • 网上商城网站设计免费咨询口腔科医生回答在线
  • 南京网站c建设云世家 s浏览器
  • 如何做镜像别人网站wordpress菜单对齐修改
  • 长春网站建设net企业公示信息查询官网
  • 金鹏建设集团网站可在哪些网站做链接
  • 电子产品网站开发背景网站关键词优化方案
  • 建网站论坛wordpress提交数据库错误
  • 国内网站建设公司开源网站系统
  • 网站开发公司上大连网站建设流程图
  • 银川网站seo宁波网
  • 个人备案网站会影响吗网站添加 备案
  • 网站建设与电子商务的教案关于旅游网站建设的方案
  • 电子商务网站建设设计原则找做网站找那个平台做
  • 天津高端品牌网站建设韶关网站建设墨子