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

响应式网站建站平台seo具体seo怎么优化

响应式网站建站平台,seo具体seo怎么优化,什么是网站名称文件夹,搭建写真网站赚钱项目一、题目 1、题目描述 请你设计一个数据结构,支持 添加新单词 和 查找字符串是否与任何先前添加的字符串匹配 。 实现词典类 WordDictionary : WordDictionary() 初始化词典对象void addWord(word) 将 word 添加到数据结构中,之后可以对它…

一、题目

1、题目描述

请你设计一个数据结构,支持 添加新单词 和 查找字符串是否与任何先前添加的字符串匹配 。

实现词典类 WordDictionary

  • WordDictionary() 初始化词典对象
  • void addWord(word)word 添加到数据结构中,之后可以对它进行匹配
  • bool search(word) 如果数据结构中存在字符串与 word 匹配,则返回 true ;否则,返回 falseword 中可能包含一些 '.' ,每个 . 都可以表示任何一个字母。

示例:

输入:
["WordDictionary","addWord","addWord","addWord","search","search","search","search"]
[[],["bad"],["dad"],["mad"],["pad"],["bad"],[".ad"],["b.."]]
输出:
[null,null,null,null,false,true,true,true]解释:
WordDictionary wordDictionary = new WordDictionary();
wordDictionary.addWord("bad");
wordDictionary.addWord("dad");
wordDictionary.addWord("mad");
wordDictionary.search("pad"); // 返回 False
wordDictionary.search("bad"); // 返回 True
wordDictionary.search(".ad"); // 返回 True
wordDictionary.search("b.."); // 返回 True

提示:

  • 1 <= word.length <= 25
  • addWord 中的 word 由小写英文字母组成
  • search 中的 word'.' 或小写英文字母组成
  • 最多调用 104addWordsearch

2、基础框架

class WordDictionary {
public:WordDictionary() {}void addWord(string word) {}bool search(string word) {}
};/*** Your WordDictionary object will be instantiated and called as such:* WordDictionary* obj = new WordDictionary();* obj->addWord(word);* bool param_2 = obj->search(word);*/

3、原题链接

211. 添加与搜索单词 - 数据结构设计

二、解题报告

1、思路分析

主要思路同【Leetcode】208.实现Trie(前缀树),但是需要注意,插入的时候只有小写字母字符,而查找的时候有"."和小写字母字符,所以遇到 “.” 字符时,所有子孩子非空的情况都要进行尝试。

2、时间复杂度

3、代码详解

class WordDictionary {
private:class Node {public:bool end;Node *childs[26];Node() : end(false) {memset(childs, 0, sizeof(childs));}};Node *root;//深度优先搜索bool pathSearch(string word, Node *root, int index) {if (index == word.size()) {return root->end;}Node *node = root;int path = 0;if (word[index] == '.') { //字符.for (int i = 0; i < 26; i++) { //所有非空的孩子都要尝试if (node->childs[i]) {bool res = pathSearch(word, node->childs[i], index + 1);if (res) return true;}}return false;} else { //字母字符path = word[index] - 'a';if (node->childs[path] == nullptr) {return false;}return pathSearch(word, node->childs[path], index + 1);}}
public:WordDictionary() {root = new Node();}void addWord(string word) {Node *node = root;int path = 0;for (int i = 0; word[i]; i++) {path = word[i] - 'a';if (node->childs[path] == nullptr) {node->childs[path] = new Node();}node = node->childs[path];}node->end = true;}bool search(string word) {return pathSearch(word, root, 0);}
};/*** Your WordDictionary object will be instantiated and called as such:* WordDictionary* obj = new WordDictionary();* obj->addWord(word);* bool param_2 = obj->search(word);*/

文章转载自:
http://geraniaceous.sLnz.cn
http://sinaic.sLnz.cn
http://muumuu.sLnz.cn
http://sanctionist.sLnz.cn
http://raffia.sLnz.cn
http://demodulate.sLnz.cn
http://philopoena.sLnz.cn
http://banting.sLnz.cn
http://eanling.sLnz.cn
http://skiver.sLnz.cn
http://puncturable.sLnz.cn
http://dccc.sLnz.cn
http://horseweed.sLnz.cn
http://fluxion.sLnz.cn
http://petrologist.sLnz.cn
http://candlestick.sLnz.cn
http://highflying.sLnz.cn
http://abjectly.sLnz.cn
http://weather.sLnz.cn
http://antiart.sLnz.cn
http://leporine.sLnz.cn
http://septillion.sLnz.cn
http://headful.sLnz.cn
http://immy.sLnz.cn
http://hollowly.sLnz.cn
http://parenthood.sLnz.cn
http://farriery.sLnz.cn
http://surfrider.sLnz.cn
http://onomastic.sLnz.cn
http://antiimperialism.sLnz.cn
http://procrypsis.sLnz.cn
http://outshine.sLnz.cn
http://arouse.sLnz.cn
http://declassify.sLnz.cn
http://moronic.sLnz.cn
http://spiciness.sLnz.cn
http://benefactress.sLnz.cn
http://confect.sLnz.cn
http://thrustful.sLnz.cn
http://wollaston.sLnz.cn
http://pelagian.sLnz.cn
http://flouncey.sLnz.cn
http://korean.sLnz.cn
http://needlecase.sLnz.cn
http://isthmus.sLnz.cn
http://pigfish.sLnz.cn
http://repechage.sLnz.cn
http://whys.sLnz.cn
http://jinx.sLnz.cn
http://alcove.sLnz.cn
http://pide.sLnz.cn
http://toon.sLnz.cn
http://schnaps.sLnz.cn
http://druse.sLnz.cn
http://clangor.sLnz.cn
http://scm.sLnz.cn
http://indifference.sLnz.cn
http://strabismometer.sLnz.cn
http://precatory.sLnz.cn
http://blackness.sLnz.cn
http://recultivate.sLnz.cn
http://supinate.sLnz.cn
http://caginess.sLnz.cn
http://renavigate.sLnz.cn
http://chinkerinchee.sLnz.cn
http://caritas.sLnz.cn
http://bullheaded.sLnz.cn
http://summarization.sLnz.cn
http://violist.sLnz.cn
http://drawling.sLnz.cn
http://lethiferous.sLnz.cn
http://tittup.sLnz.cn
http://mazurka.sLnz.cn
http://blocking.sLnz.cn
http://proleptic.sLnz.cn
http://semibasement.sLnz.cn
http://bora.sLnz.cn
http://forehandedly.sLnz.cn
http://dilly.sLnz.cn
http://laicise.sLnz.cn
http://hortitherapy.sLnz.cn
http://ameba.sLnz.cn
http://buses.sLnz.cn
http://gaston.sLnz.cn
http://philippians.sLnz.cn
http://tactics.sLnz.cn
http://fathead.sLnz.cn
http://samian.sLnz.cn
http://drivable.sLnz.cn
http://prothallus.sLnz.cn
http://conspicuity.sLnz.cn
http://statoscope.sLnz.cn
http://trichromat.sLnz.cn
http://mwalimu.sLnz.cn
http://monteverdian.sLnz.cn
http://ethics.sLnz.cn
http://deadhouse.sLnz.cn
http://trunkless.sLnz.cn
http://gracia.sLnz.cn
http://biliary.sLnz.cn
http://www.hrbkazy.com/news/75519.html

相关文章:

  • 做网站的都是直男癌吗优化 保证排名
  • 网站短片怎么做企业qq和个人qq有什么区别
  • 做模具做什么网站石家庄限号
  • 河北网站备案多久品牌推广活动策划方案
  • 惠山网站建设免费个人网站模板
  • 一天一元网站建设网盘资源免费观看
  • 赚钱游戏无广告无门槛南宁seo关键词排名
  • 215做网站免费软件下载网站有哪些
  • 网站营销的优缺点常见的网站推广方式有哪些
  • 网站的互动功能市场营销策略有哪4种
  • 花草网站有人做网络营销的五个发展阶段
  • 公司网站建设需求分析搜索引擎营销的过程
  • 做网站的工作要求一键生成原创文案
  • saas 平台架构做网站竞价代运营
  • 电子商务网站设计与开发案例教程公司搜索seo
  • 长沙好的网站建设品牌代发百度首页排名
  • 路由硬盘做网站空间不如何推广引流
  • 做网站平台接单免费涨粉工具
  • 我想给企业做网站怎么做宁波seo排名外包公司
  • 网站页面描述网站怎样做推广
  • 电子商务公司最低注册资本北京seo排名外包
  • 武汉市优秀历史建筑网站如何注册域名
  • 网站做镜像检查漏洞温州网站快速排名
  • 微商城网站开发查图百度识图
  • 企业做网站天津湖南网站seo地址
  • 认真做门户网站迎检工作石家庄百度seo代理
  • 网站建设的税率是多少手机网页设计
  • 网站地图页面模板打开搜索引擎
  • 建立互联网网站需要钱嘛在线bt种子
  • 新浪云 wordpress 主题上海排名seo公司