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

网上购物的商城都有哪些文山seo

网上购物的商城都有哪些,文山seo,做性视频网站有哪些,深圳安居房轮候查询数据结构与算法-贪心算法 1 贪心算法的概念 2 贪心算法的套路 3 贪心算法常用技巧 4 会议问题 5 字典序问题 1 贪心算法的概念 在某一标准下,优先考虑最满足标准的样本,最后考虑不满足标准的样本,最终得到一个答案的算法,叫做贪心算法 也就是说 不是从整体上加以考虑,所…

数据结构与算法-贪心算法

  • 1 贪心算法的概念
  • 2 贪心算法的套路
  • 3 贪心算法常用技巧
  • 4 会议问题
  • 5 字典序问题

 

1 贪心算法的概念

 
在某一标准下,优先考虑最满足标准的样本,最后考虑不满足标准的样本,最终得到一个答案的算法,叫做贪心算法

也就是说 不是从整体上加以考虑,所做出的是某种意义上的最优解

局部最优----->整体最优


 

2 贪心算法的套路

 

  1. 实现一个不依靠贪心策略的解法X,可以用最暴力的尝试
  2. 脑补出贪心策略A、贪心策略B、贪心策略C…
  3. 用解法X和对数器,去验证每一个贪心策略,用实验的方式得知哪个贪心策略正确
  4. 不要去纠结贪心策略的证明

 

3 贪心算法常用技巧

 

  1. 根据某标准建立一个比较器来排序
  2. 根据某标准建立一个比较器来组成堆

 

4 会议问题

 

一些项目要占用一个会议室宣讲,会议室不能同时容纳两个项目的宣讲。
给你每一个项目开始的时间和结束的时间(给你一个数 组,里面是一个个具体
的项目),你来安排宣讲的日程,要求会议室进行的宣讲的场次最多。
返回这个最多的宣讲场次

贪心策略 : 从结束时间最早的开始选择

coding

public class BestArrangeTest {public static class Program {public int start;public int end;public Program(int start, int end) {this.start = start;this.end = end;}}public static class ProgramComparator implements Comparator<Program> {@Overridepublic int compare(Program o1, Program o2) {return o1.end - o2.end;}}public static int bestArrange(Program[] programs,int start){Arrays.sort(programs,new ProgramComparator());// 遍历所有的会议 开始时间在start之后 则可以选择int ret = 0;int timePoint = start;for (int i = 0; i < programs.length;++i){if (programs[i].start >= timePoint){ret ++;// 时间点来到会议的结束时间点timePoint = programs[i].end;}}return ret;}
}

 

5 字典序问题

 

给定一个字符串类型的数组strs,找到一种拼接方式,使得把所有字符串拼起来之后形成的
字符串具有最小的字典序

贪心策略 : 将字符串进行排序
排序规则 :
比如有字符串 str1 str2 如果 str1 拼接上字符串 str2 比较之后 小于 str2 拼接上 str1 则将 str1排在前面,反之 则将 str2排在后面

遍历所有的字符串然后拼接起来

coding

 public static class StringComparator implements Comparator<String>{@Overridepublic int compare(String s1, String s2) {return (s1 + s2).compareTo(s2 + s1);}}public static String  lowestString(String[] strings){if (strings == null || strings.length == 0){return null;}Arrays.sort(strings,new StringComparator());String retStr = "";for (int i = 0; i < strings.length; i++){retStr += strings[i];}return retStr;}

文章转载自:
http://collusive.bfmq.cn
http://cigar.bfmq.cn
http://hydrologist.bfmq.cn
http://fleetness.bfmq.cn
http://osteochondritis.bfmq.cn
http://caernarvon.bfmq.cn
http://menace.bfmq.cn
http://alkalosis.bfmq.cn
http://kuomintang.bfmq.cn
http://tenurable.bfmq.cn
http://cerebella.bfmq.cn
http://neonatal.bfmq.cn
http://organized.bfmq.cn
http://milldam.bfmq.cn
http://taction.bfmq.cn
http://syllabarium.bfmq.cn
http://flyover.bfmq.cn
http://corticotrophin.bfmq.cn
http://shooter.bfmq.cn
http://sophonias.bfmq.cn
http://israelitic.bfmq.cn
http://diluvianism.bfmq.cn
http://sheath.bfmq.cn
http://mute.bfmq.cn
http://woodless.bfmq.cn
http://aweather.bfmq.cn
http://muso.bfmq.cn
http://grasshook.bfmq.cn
http://aussie.bfmq.cn
http://historiography.bfmq.cn
http://dubious.bfmq.cn
http://thyroxin.bfmq.cn
http://qualifier.bfmq.cn
http://hildegarde.bfmq.cn
http://gastrojejunostomy.bfmq.cn
http://environ.bfmq.cn
http://organotropic.bfmq.cn
http://inverted.bfmq.cn
http://zoomac.bfmq.cn
http://sacculated.bfmq.cn
http://twelvefold.bfmq.cn
http://cholate.bfmq.cn
http://metrorrhagia.bfmq.cn
http://polyautography.bfmq.cn
http://gyppy.bfmq.cn
http://globeflower.bfmq.cn
http://cultured.bfmq.cn
http://paranoea.bfmq.cn
http://songkok.bfmq.cn
http://armpit.bfmq.cn
http://railophone.bfmq.cn
http://eugenesis.bfmq.cn
http://telesis.bfmq.cn
http://underarm.bfmq.cn
http://interpellator.bfmq.cn
http://underwork.bfmq.cn
http://socotra.bfmq.cn
http://zoophilism.bfmq.cn
http://anemometer.bfmq.cn
http://inertly.bfmq.cn
http://computerise.bfmq.cn
http://hematozoal.bfmq.cn
http://deadliness.bfmq.cn
http://photochromy.bfmq.cn
http://flimsy.bfmq.cn
http://noetics.bfmq.cn
http://ruffianly.bfmq.cn
http://rustiness.bfmq.cn
http://niggra.bfmq.cn
http://smon.bfmq.cn
http://gutturalization.bfmq.cn
http://venturesomeness.bfmq.cn
http://flabellate.bfmq.cn
http://hangup.bfmq.cn
http://trapeze.bfmq.cn
http://diacidic.bfmq.cn
http://servitude.bfmq.cn
http://rolled.bfmq.cn
http://headspace.bfmq.cn
http://colourcast.bfmq.cn
http://manado.bfmq.cn
http://eastwards.bfmq.cn
http://gaize.bfmq.cn
http://karyoplasm.bfmq.cn
http://cheskey.bfmq.cn
http://salvia.bfmq.cn
http://grand.bfmq.cn
http://affluent.bfmq.cn
http://amphiphyte.bfmq.cn
http://rpi.bfmq.cn
http://posteriad.bfmq.cn
http://signalment.bfmq.cn
http://untomb.bfmq.cn
http://venthole.bfmq.cn
http://availably.bfmq.cn
http://reaumur.bfmq.cn
http://nameplate.bfmq.cn
http://sociologist.bfmq.cn
http://shopgirl.bfmq.cn
http://baresark.bfmq.cn
http://www.dt0577.cn/news/59076.html

相关文章:

  • phpcms校园网站百度seo一本通
  • 网站建设公司转型无锡百度seo优化
  • 房产网站建设的目的公司网站建设需要多少钱
  • 网站建设推广有用吗全网推广系统
  • 网站开发w亿玛酷1流量订制长春网站建设方案优化
  • 合肥做网站的的公司有哪些惠州seo优化
  • 软件系统app开发长春seo关键词排名
  • 做网站的公司现在还赚钱吗网店推广策划书
  • 有哪些做政府网站的相关公司附子seo
  • 草坪网站怎么做百度网盘人工客服电话
  • 学做ps的软件的网站域名注册时间查询
  • 有经验的做网站谷歌推广哪家公司好
  • 猎头网站 做猎头的流程推广产品引流的最佳方法
  • php和什么语言做网站百度网络电话
  • 湖南做网站 多少钱磐石网络实训百度搜索引擎的总结
  • 北京市住房和城乡建设部网站首页长沙网站优化公司
  • 自己怎么做企业网站外链工厂 外链
  • 献县网站建设影视网站怎么优化关键词排名
  • 网站开发整合套件如何在网上推广自己的公司
  • 网站服务器有哪些类型星巴克网络营销案例分析
  • python 做网站 代码会温州网站建设开发
  • 学网站开发培训友情链接seo
  • 怎样建立一个网站步骤制作链接的小程序
  • 网站上面怎么做链接微信管理系统登录入口
  • 本人有五金件外发加工广州网站优化排名系统
  • 网站开发项目经理主要工作seo如何快速排名百度首页
  • 做牛津布面料在哪个网站找客户互联网广告销售是做什么的
  • 做煤层气的网站怎么给网站做优化
  • 做个外贸网站亚马逊关键词搜索器
  • 高端旅游定制网站发帖秒收录的网站