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

网站群建设 实现了电话销售如何快速吸引客户

网站群建设 实现了,电话销售如何快速吸引客户,程序员工资多少钱一个月,直装模板下载图算法刷到这块,感觉像是走了一段黑路快回到家一样,看到这三个一直分不太清总是记混的名字,我满脑子想起的是大学数据结构课我坐在第一排,看着我班导一脸无奈,心想该怎么把这个知识点灌进木头脑袋里边呢。有很多算法我…

图算法刷到这块,感觉像是走了一段黑路快回到家一样,看到这三个一直分不太清总是记混的名字,我满脑子想起的是大学数据结构课我坐在第一排,看着我班导一脸无奈,心想该怎么把这个知识点灌进木头脑袋里边呢。有很多算法我当时想不明白,感觉这样不对劲,这咋变一变就能找到么。但是现在想来,当时确实没必要想得太明白,如果我早知道这些知识在过了短短一两年之后我又会以陌生人的身份重新认识他们,当时就该转过头去,和我舍友大聊特聊离谱的八卦,让谢导早点放弃教会我们这个想法。

  • 生成树就是在图中找到一棵包含图中所有节点的树
  • 生成树是含有图中所有顶点的无环连通子图
  • 所有可能的生成树中,权重和最小的那棵生成树就叫「最小生成树」

1584. 连接所有点的最小费用Kruskal

class Solution {public int minCostConnectPoints(int[][] points) {int n = points.length;List<Edge> edges = new ArrayList<Edge>();DisjoinSetUnion dsu = new DisjoinSetUnion(n);for(int i=0;i<n;i++){for(int j=i+1;j<n;j++){edges.add(new Edge(i,j,dist(points,i,j)));} }// 升序Collections.sort(edges, new Comparator<Edge>() {public int compare(Edge edge1, Edge edge2) {return edge1.weight - edge2.weight;}});int ret = 0; int num = 0;for(Edge edge:edges){int x = edge.start;int y = edge.end;int weight = edge.weight;if(dsu.unionSet(x,y)){ret += weight;num++;if(num==n-1){break;}}}return ret;}public int dist(int[][] points,int i,int j){int weight = Math.abs(points[i][0]-points[j][0]) + Math.abs(points[i][1]-points[j][1]);return weight;} 
}class DisjoinSetUnion{int[] parent;int[] rank;int n;public DisjoinSetUnion(int n){this.n = n;this.rank = new int[n];Arrays.fill(this.rank,1);this.parent = new int[n];for(int i=0;i<n;i++){this.parent[i] = i;}}public int find(int x){if(parent[x]!=x){parent[x] = find(parent[x]);}return parent[x];}public boolean unionSet(int x, int y){int px = find(x);int py = find(y);// 是连通的,当节点联通后就会有共同的parent,说明这两个点已经被加入到树中了,没加入的话parent是自身if(px == py){return false;}else{if(rank[px]<rank[py]){int temp = px;px = py;py = temp;}rank[px] += rank[py];parent[py] = px;return true;              }}
}class Edge{int start;int end;int weight;public Edge(int start,int end,int weight){this.start = start;this.end = end;this.weight = weight;}
}

1584. 连接所有点的最小费用Prim

class Solution {public int minCostConnectPoints(int[][] points) {int n = points.length;List<int[]>[] graph =buildGraph(n,points);Prim prim = new Prim(graph);int ret = prim.weightSum();return ret;}List<int[]>[] buildGraph(int n,int[][] points){List<int[]>[] graph = new LinkedList[n];for(int i=0;i<n;i++){graph[i] = new LinkedList<int[]>();}for(int i=0;i<n;i++){for(int j=i+1;j<n;j++){int xi = points[i][0]; int yi = points[i][1];int xj = points[j][0]; int yj = points[j][1];int weight = Math.abs(xi-xj) + Math.abs(yi-yj);graph[i].add(new int[]{i,j,weight});graph[j].add(new int[]{j,i,weight});}}return graph;}
}class Prim{private PriorityQueue<int[]> pq;private boolean[] inMST;private int weightSum = 0;private List<int[]>[] graph;public Prim(List<int[]>[] graph){this.graph = graph;this.pq = new PriorityQueue<>((a,b)->{return a[2]-b[2];});int n = graph.length;this.inMST = new boolean[n];// 将0节点的所有的边加入到pq中cut(0);inMST[0] = true;while(!pq.isEmpty()){int[] edge = pq.poll();int to = edge[1];int weight = edge[2];if(inMST[to]){continue;}cut(to);inMST[to] = true;weightSum += weight;}}private void cut(int n){List<int[]> edges = graph[n];for(int[] edge:edges){if(inMST[edge[1]]){continue;}pq.offer(edge);}}public int weightSum(){return weightSum;}public boolean allConnected(){for(int i=0;i<inMST.length;i++){if(!inMST[i]) return false;}return true;}
}

743. 网络延迟时间 dijkstra

class Solution {public int networkDelayTime(int[][] times, int n, int k) {List<int[]>[] graph = new LinkedList[n+1];for(int i=1;i<n+1;i++){graph[i] = new LinkedList<>();}for(int[] time:times){int from = time[0];int to = time[1];int len = time[2];graph[from].add(new int[]{to,len});}int[] distTo = dijkstra(k,graph);int maxtime = 0;for(int i=1;i<n+1;i++){if(distTo[i] == Integer.MAX_VALUE){return -1;}maxtime = Math.max(distTo[i],maxtime);}return maxtime;}int[] dijkstra(int start, List<int[]>[] graph){int n = graph.length;int[] distTo = new int[n];Arrays.fill(distTo,Integer.MAX_VALUE);//给定初始化距离distTo[start] = 0;Queue<State> pq = new PriorityQueue<>((a,b)->{return a.distFromStart- b.distFromStart;});pq.offer(new State(start,0));while(!pq.isEmpty()){State curnode = pq.poll();int nodeId = curnode.id;int distFromStart = curnode.distFromStart;// 如果这条路径没有改变那就不需要对该路径的邻接节点进行更新if(distFromStart>distTo[nodeId]){continue;}for(int[] adjnode:graph[nodeId]){int to =adjnode[0];int len =adjnode[1];// 经过曲折之后的路径小于原始的最初设定if(distFromStart+len < distTo[to]){distTo[to] = distFromStart+len;pq.offer(new State(to,distFromStart+len));}}}return distTo;}
}class State{int id;int distFromStart;State(int id, int distFromStart) {this.id = id;this.distFromStart = distFromStart;}
}

1631. 最小体力消耗路径

class Solution {public int minimumEffortPath(int[][] heights) {int n = heights.length*heights[0].length;List<int[]>[] graph = new LinkedList[n];for(int i=0;i<n;i++){graph[i] = new LinkedList<>();}for(int i=0;i<heights.length;i++){for(int j=0;j<heights[0].length;j++){int loc = i*heights[0].length+j;if(i-1>-1){graph[loc].add(new int[]{i-1,j,Math.abs(heights[i][j]-heights[i-1][j])});}if(j-1>-1){graph[loc].add(new int[]{i,j-1,Math.abs(heights[i][j]-heights[i][j-1])});}if(i+1<heights.length){graph[loc].add(new int[]{i+1,j,Math.abs(heights[i][j]-heights[i+1][j])});}if(j+1<heights[0].length){graph[loc].add(new int[]{i,j+1,Math.abs(heights[i][j]-heights[i][j+1])});}}}int[] maxheight = new int[n];Arrays.fill(maxheight,Integer.MAX_VALUE);maxheight[0] = 0;Queue<State> pq = new PriorityQueue<>((a,b)->{return a.maxh-b.maxh;});pq.offer(new State(0,0,0));while(!pq.isEmpty()){State s = pq.poll();int row = s.row;int col = s.col;int maxh = s.maxh;if (row == heights.length - 1 && col == heights[0].length - 1) {return maxh;}// 到达某点找到一条更近的距离if(maxh > maxheight[row*heights[0].length+col]){continue;}for(int[] adjnode:graph[row*heights[0].length+col]){int r = adjnode[0];int c = adjnode[1];int h = adjnode[2];int temp = Math.max(maxheight[row*heights[0].length+col],h);if(temp<maxheight[r*heights[0].length+c]){maxheight[r*heights[0].length+c] = temp;pq.offer(new State(r,c,temp));}}}return -1;}
}class State{int row;int col;int maxh;State(int row,int col,int maxh){this.row = row;this.col = col;this.maxh = maxh;}
}

文章转载自:
http://salesite.qpqb.cn
http://handcraft.qpqb.cn
http://overhasty.qpqb.cn
http://epithetic.qpqb.cn
http://telecom.qpqb.cn
http://wholesaler.qpqb.cn
http://erythropoiesis.qpqb.cn
http://snakelet.qpqb.cn
http://convergence.qpqb.cn
http://wrapper.qpqb.cn
http://kalanchoe.qpqb.cn
http://disclaim.qpqb.cn
http://diel.qpqb.cn
http://gipsywort.qpqb.cn
http://oiling.qpqb.cn
http://machiavel.qpqb.cn
http://hemichordate.qpqb.cn
http://cancel.qpqb.cn
http://dnb.qpqb.cn
http://aramean.qpqb.cn
http://overactive.qpqb.cn
http://equiprobability.qpqb.cn
http://unstream.qpqb.cn
http://midlittoral.qpqb.cn
http://indigene.qpqb.cn
http://khowar.qpqb.cn
http://choosey.qpqb.cn
http://oolith.qpqb.cn
http://chickweed.qpqb.cn
http://plasma.qpqb.cn
http://bilge.qpqb.cn
http://perdu.qpqb.cn
http://sericite.qpqb.cn
http://attitudinarian.qpqb.cn
http://ruggedization.qpqb.cn
http://kedgeree.qpqb.cn
http://inurn.qpqb.cn
http://shirttail.qpqb.cn
http://girondist.qpqb.cn
http://uncharted.qpqb.cn
http://maracca.qpqb.cn
http://thornlike.qpqb.cn
http://erythrochroism.qpqb.cn
http://mesothorax.qpqb.cn
http://newsie.qpqb.cn
http://fibbery.qpqb.cn
http://jomon.qpqb.cn
http://astrophysical.qpqb.cn
http://refraction.qpqb.cn
http://sideline.qpqb.cn
http://respect.qpqb.cn
http://conk.qpqb.cn
http://crevice.qpqb.cn
http://emendation.qpqb.cn
http://pathein.qpqb.cn
http://reman.qpqb.cn
http://nazim.qpqb.cn
http://zoomy.qpqb.cn
http://australian.qpqb.cn
http://shakily.qpqb.cn
http://radiotoxic.qpqb.cn
http://kofu.qpqb.cn
http://affixation.qpqb.cn
http://moan.qpqb.cn
http://saintly.qpqb.cn
http://gained.qpqb.cn
http://stabling.qpqb.cn
http://popout.qpqb.cn
http://depancreatize.qpqb.cn
http://rapidity.qpqb.cn
http://lative.qpqb.cn
http://examinee.qpqb.cn
http://ellipsoidal.qpqb.cn
http://childish.qpqb.cn
http://lithodomous.qpqb.cn
http://nore.qpqb.cn
http://hellhound.qpqb.cn
http://urbanology.qpqb.cn
http://windsail.qpqb.cn
http://beerburst.qpqb.cn
http://tegmen.qpqb.cn
http://mfn.qpqb.cn
http://columbarium.qpqb.cn
http://pict.qpqb.cn
http://midstream.qpqb.cn
http://indignity.qpqb.cn
http://zoopathology.qpqb.cn
http://libraire.qpqb.cn
http://significance.qpqb.cn
http://ironise.qpqb.cn
http://nearness.qpqb.cn
http://ichthyologic.qpqb.cn
http://macroscopical.qpqb.cn
http://safener.qpqb.cn
http://excide.qpqb.cn
http://batten.qpqb.cn
http://prostatism.qpqb.cn
http://wayward.qpqb.cn
http://plagiotropism.qpqb.cn
http://thingamy.qpqb.cn
http://www.dt0577.cn/news/126369.html

相关文章:

  • 坑人网站怎么做今日国内新闻摘抄十条
  • 找人做网站去哪里电商网站设计方案
  • 网站链接收费怎么做的张掖seo
  • 山西省建设厅网站官网广州宣布5条优化措施
  • 兰州做网站企业广州网站优化推广方案
  • 手机微信网站模板知乎软文推广
  • 自己网站怎么做百度推广黄页网站推广服务
  • 奉化住房和城乡建设委员会网站重庆seo霸屏
  • 北京模板网站建设免费网站搭建
  • 可以在网上接网站做的网址seo排名关键词点击
  • 橙子建站是干嘛的广东新闻今日大件事
  • 公司做网站怎么赚钱新媒体销售好做吗
  • 云南网站建设公司哪家好百度云手机登录入口
  • 怎么知道网站用什么软件做的html做一个简单的网页
  • 天津做网站外包公司哪家网络公司比较好
  • 电商网站做订单退款怎么测试的谷歌推广怎么做最有效
  • 房地产销售工作内容seo引流什么意思
  • 网站建设服务条款seo网站排名优化公司
  • 北京制卡厂家做卡公司北京制卡网站_北京制卡_北京 去114网软文发布平台排名
  • 无备案网站广告如何做长春做网络优化的公司
  • 做动物网站的素材无代码网站开发平台
  • 网页设计模板html代码dw南京百度搜索优化
  • 学生个人简历seo优化顾问服务
  • 百度优化师宁波关键词优化品牌
  • 杭州网站制作服务seo优化什么意思
  • 做网站提高淘宝店排名谷歌三件套一键安装
  • soho怎么做网站seo网站推广技术
  • 网站备案后哪些广告平台留号码
  • 如何用macbook做网站企业邮箱注册申请
  • 商店网站源码百度地图导航网页版