联合开发网   搜索   要求与建议
                登陆    注册
排序按匹配   按投票   按下载次数   按上传日期
按分类查找All 数据结构(371) 
按平台查找All Visual C++(371) 

[数据结构] Q4.8

// You are given a binary tree in which each node contains a value. Design an algorithm to print all paths which sum up to that value. Note that it can be any path in the tree - it does not have to start at the root. // 给定一棵二叉树,每个结点包含一个值。打印出所有满足以下条件的路径: 路径上结点的值加起来等于给定的一个值。注意:这些路径不必从根结点开始。 方案1:如果结点中包含指向父亲结点的指针,那么,只需要去遍历这棵二叉树, 然后从每个结点开始,不断地去累加上它父亲结点的值直到父亲结点为空(这个具有唯一性, 因为每个结点都只有一个父亲结点。也正因为这个唯一性, 可以不另外开额外的空间来保存路径),如果等于给定的值sum,则打印输出。 方案2:如果结点中不包含指向父亲结点的指针,则在二叉树从上向下查找路径的过程中, 需要为每一次的路径保存中间结果,累加求和仍然是从下至上的,对应到保存路径的数组, 即是从数组的后面开始累加的,这样能保证遍历到每一条路径。
// You are given a binary tree in which each node contains a value Design an algorithm to print all paths which sum up to that value Note that it can be any path in the tree-.. It does not have to start at the root // Given a binary tree, each node contains a value. Print out all the following conditions are met path: the path to the node values ​ ​ add up to a given value. Note: These paths do not have to start the root. Scenario 1: If the node contains a pointer pointing to the father node, then just go to traverse the binary tree, and then start each node to constantly tired, plus the value of its parent node until the father node empty (this is unique, because each node has only one parent node. It is because of this uniqueness, can not otherwise open additional space to store the path), if the value is equal to a given sum, the printout . Scenario 2: If the node does not contain a pointer pointing to the father node, then the binary search path down the process, t (2014-11-20, Visual C++, 18KB, 下载3次)

http://www.pudn.com/Download/item/id/2658959.html

[数据结构] eightqueen

八皇后问题,是一个古老而著名的问题,是回溯算法的典型案例。该问题是国际西洋棋棋手马克斯·贝瑟尔于1848年提出:在8X8格的国际象棋上摆放八个皇后,使其不能互相攻击,即任意两个皇后都不能处于同一行、同一列或同一斜线上,问有多少种摆法。 高斯认为有76种方案。1854年在柏林的象棋杂志上不同的作者发表了40种不同的解,后来有人用图论的方法解出92种结果。计算机发明后,有多种方法可以解决此问题。
Eight queens problem is an old and well-known problems, is a typical case of backtracking algorithms. The problem is that the international chess players Spey Mark Searle made in 1848: eight queen placed on a 8X8 grid chess, it can not attack each other, that any two Queen can not in the same line, same column or on the same diagonal, and asked how many pendulum method. There are 76 kinds of programs Gauss considered. 1854 in Berlin chess magazine published by 40 different authors of different solutions, and later was used graph theory methods to the 92 kinds of results. After the invention of the computer, there are several ways to solve this problem. (2014-05-28, Visual C++, 6KB, 下载3次)

http://www.pudn.com/Download/item/id/2554146.html

[数据结构] Stack

堆栈实现。堆栈就是这样一种数据结构。它是在内存中开辟一个存储区域,数据一个一个顺序地存入(也就是“压入——push”)这个区域之中。有一个地址指针总指向最后一个压入堆栈的数据所在的数据单元,存放这个地址指针的寄存器就叫做堆栈指示器。开始放入数据的单元叫做“栈底”。数据一个一个地存入,这个过程叫做“压栈”。在压栈的过程中,每有一个数据压入堆栈,就放在和前一个单元相连的后面一个单元中,堆栈指示器中的地址自动加1。读取这些数据时,按照堆栈指示器中的地址读取数据,堆栈指示器中的地址数自动减 1。这个过程叫做“弹出pop”。如此就实现了后进先出的原则。
Stack implementation. Stack is such a data structure. It was opened in memory a storage area, the data one by one sequentially deposited (ie " push- push" ) into this area. There is an address pointer always points to the last one where the data is pushed onto the stack data unit, the address pointer stored is called the stack pointer register. Start the data into a unit called the " bottom of the stack." Data stored in one by one, this process is called " push." In the push process, each having a data onto the stack, and the previous one is placed behind the unit is connected to a unit, the stack pointer in the address is automatically incremented by 1. Read the data, in accordance with the address of the stack pointer in the read data, the number of addresses in the stack pointer is decremented by one. This process is called " pop pop" . So to achieve a LIFO principle. (2013-06-27, Visual C++, 1KB, 下载1次)

http://www.pudn.com/Download/item/id/2290768.html

[数据结构] Dijkstra

Dijkstra(迪杰斯特拉)算法是典型的单源最短路径算法,用于计算一个节点到其他所有节点的最短路径。主要特点是以起始点为中心向外层层扩展,直到扩展到终点为止。Dijkstra算法是很有代表性的最短路径算法,在很多专业课程中都作为基本内容有详细的介绍,如数据结构,图论,运筹学等等。Dijkstra一般的表述通常有两种方式,一种用永久和临时标号方式,一种是用OPEN, CLOSE表的方式,这里均采用永久和临时标号的方式。注意该算法要求图中不存在负权边。
Dijkstra (Dijkstra) algorithm is a typical single-source shortest path algorithm, is used to calculate a node to all other nodes in the shortest path. The main features is the starting point as the center outward expansion layers until the extension to the end point. Dijkstra algorithm is very representative of the shortest path algorithm, the basic content as described in detail in many professional courses, such as data structures, graph theory, operations research, and so on. Dijkstra' s general statements are generally two ways, one permanent and temporary label, one is using the OPEN, CLOSE table, there are permanent and temporary label. Note that the algorithm requires that the figure does not exist in the negative right side. (2013-05-12, Visual C++, 1KB, 下载1次)

http://www.pudn.com/Download/item/id/2239172.html

[数据结构] dijkstra

虽然草儿是个路痴(就是在杭电待了一年多,居然还会在校园里迷路的人,汗~),但是草儿仍然很喜欢旅行,因为在旅途中 会遇见很多人(白马王子,^0^),很多事,还能丰富自己的阅历,还可以看美丽的风景……草儿想去很多地方,她想要去东京铁塔看夜景,去威尼斯看电影,去阳明山上看海芋,去纽约纯粹看雪景,去巴黎喝咖啡写信,去北京探望孟姜女……眼看寒假就快到了,这么一大段时间,可不能浪费啊,一定要给自己好好的放个假,可是也不能荒废了训练啊,所以草儿决定在要在最短的时间去一个自己想去的地方!因为草儿的家在一个小镇上,没有火车经过,所以她只能去邻近的城市坐火车(好可怜啊~)。
Although the grass is Luchi (in Hang power for more than a year, actually will get lost in the campus, Khan ~), but the grass was still really like to travel, because you' ll meet on the road a lot of people (Prince Charming ^ 0 ^), a lot of things, but also to enrich their experience, you can also see the beautiful scenery ... grass want to go to many places, she wanted to go to Tokyo Tower to see the night and go to Venice to see the movie, go to Yangmingshan point of view the sea taro, go to New York just look at the snow, write to drink coffee in Paris, went to Beijing to visit Mengjiangnu ...... seeing the winter break is coming such a long period of time can not be wasted, must give themselves good to put a fake, but also not abandoned the training ah, so the grass was decided to go to a place to go in the shortest time! Grass of home in a small town, not a train passed, so she can only go to neighboring cities by train (poor ah ~). (2012-09-20, Visual C++, 1KB, 下载4次)

http://www.pudn.com/Download/item/id/1997700.html

[数据结构] ShortestPathDijkstra

Dijkstra(迪杰斯特拉)算法是典型的单源最短路径算法,用于计算一个节点到其他所有节点的最短路径。主要特点是以起始点为中心向外层层扩展,直到扩展到终点为止。Dijkstra算法是很有代表性的最短路径算法,在很多专业课程中都作为基本内容有详细的介绍,如数据结构,图论,运筹学等等。Dijkstra一般的表述通常有两种方式,一种用永久和临时标号方式,一种是用OPEN, CLOSE表的方式,这里均采用永久和临时标号的方式。注意该算法要求图中不存在负权边。
Dijkstra (Dijkstra) algorithm is a typical single-source shortest path algorithm is used to calculate a node to all other nodes in the shortest path. The main characteristics is the starting point as the center outward expansion layers until the extension to the end date. The Dijkstra algorithm shortest path algorithm is very representative of the many professional courses as a detailed introduction to the basic content, such as data structures, graph theory, operations research, and so on. The Dijkstra general statements are generally two ways, one with permanent and temporary label, OPEN, CLOSE table, here are a permanent and temporary label. Note that the algorithm requires that there is no negative side figure. (2012-09-06, Visual C++, 2KB, 下载3次)

http://www.pudn.com/Download/item/id/1986159.html

[数据结构] (stu)File1

打开一个文件,逐行读取生成一个英文字符的索引,产生一个文件保存输入文件中的字符出现的次数、个数和种类。 1、一次读取文件的一行;读取文件使用iostream; 2、除去行中所有的标点符号,利用附录A的程序代码; 3、对于每一行: a)在你构建的索引结构中查找单词; b)如果没有找到(出现新词)就将它插入索引; c)如果找到就更新该词的出现次数(次数加1)。 4、所有行都读入完成后,对索引结构按照字典顺序进行排序。每一行都应包括该单词本身、出现次数,如果有能力,程序还应包含出现该单词的页码; 目标:使用C++语言为任意书籍构造索引字典(英文书)。 输入:书籍的文本文件;测试用例为abc.txt 输出:包含索引的文本文件,包括排序后的英文字典,英文出现次数,出现该英文的页码
Open a file, read line by line to generate an English character index, resulting in the number of occurrences, the number and types of characters in a file to save the input file. Time to read the file line to read the file using the iostream remove the line, all the punctuation, the use of Appendix A of the code 3, for each line: a) find the word you build the index structure b) If not found (new word) will insert it into the index c) if found to update the number of occurrences of the term (number plus 1). 4, all rows are read into the completed index structure in accordance with the dictionary order sort. Each line should include the word itself, occurrences, if you have the ability, the program should also include the page number of the word target: use C++ language to construct an index for any book dictionary (English books). Input: books, text files test cases abc.txt output: a text file that contains the index, sorted and English dictionary, English occurrences, the page (2012-07-20, Visual C++, 2KB, 下载8次)

http://www.pudn.com/Download/item/id/1944359.html

[数据结构] dijkstra

Dijkstra(迪杰斯特拉)算法是典型的单源最短路径算法,用于计算一个节点到其他所有节点的最短路径。主要特点是以起始点为中心向外层层扩展,直到扩展到终点为止。Dijkstra算法是很有代表性的最短路径算法,在很多专业课程中都作为基本内容有详细的介绍,如数据结构,图论,运筹学等等。Dijkstra一般的表述通常有两种方式,一种用永久和临时标号方式,一种是用OPEN, CLOSE表的方式,这里均采用永久和临时标号的方式。注意该算法要求图中不存在负权边。
Dijkstra (Dijkstra) algorithm is a typical single-source shortest path algorithm used to calculate the shortest path of a node to all other nodes. The main features are the starting point as the center outward expansion of the layers, until the extension to the end point so far. Dijkstra algorithm is very representative of the shortest path algorithm, described in detail in many professional courses as a basic content, such as data structures, graph theory, operations research, etc.. Dijkstra general statements are generally two ways, a permanent and temporary label, an OPEN, CLOSE table, here are the way of permanent and temporary label. Note that the algorithm requires that the figure does not negative the right side. (2012-04-27, Visual C++, 96KB, 下载3次)

http://www.pudn.com/Download/item/id/1846760.html

[数据结构] charu

有一个已经有序的数据序列,要求在这个已经排好的数据序列中插入一个数,但要求插入后此数据序列仍然有序,这个时候就要用到一种新的排序方法——插入排序法,插入排序的基本操作就是将一个数据插入到已经排好序的有序数据中,从而得到一个新的、个数加一的有序数据,算法适用于少量数据的排序,时间复杂度为O(n^2)。是稳定的排序方法。插入算法把要排序的数组分成两部分:第一部分包含了这个数组的所有元素,但将最后一个元素除外,而第二部分就只包含这一个元素。在第一部分排序后,再把这个最后元素插入到此刻已是有序的第一部分里的位置
One has been ordered sequence of data in this row has been good data in the sequence to insert a number, but the orderly sequence of this data is still asked to insert this time is necessary to use a new sort- insertion sortmethod, the basic operation of the insertion sort is to insert a data to ordinal data that has been sorted, ordered data to get a new number plus one, the algorithm is suitable for the sort of small amounts of data, the time complexity isO (n ^ 2). Is a stable sort. Insertion algorithm to sort an array is divided into two parts: The first section contains all the elements of the array, but excluding the last element, while the second part contains only one element. In the first part of the sort, and then this last element is inserted into the moment has ordered the first part of the location of (2012-04-18, Visual C++, 1KB, 下载2次)

http://www.pudn.com/Download/item/id/1833894.html

[数据结构] josephus

问题描述: 新Josephus排列问题定义如下:假设n个人排成一个环形,给定一个正整数m,从第1 个人开始,沿环计数,每遇到第m个人就让其出列,这时计算器m自动加一,且计数继续进 行下去。这个过程一直进行到所有的人都出列为止,最后出列者为赢家。设这n个人的编号 分别为1~n,每次从编号为1的竞赛者开始计数,那么每个人出列的次序定义为整数1~n 的一个排列。这个排列称为一个(n,m)Josephus排列。 例如,(7,3)Josephus 排列为3,7,6,2,4,1,5。 对于给定的1,2,…,n中的k个数,Josephus想知道是否存在一个正整数m使得 (n,m)Josephus排列的前k个数恰为事先指定的这k个数。 编程任务: (1)用抽象数据类型表设计一个求(n,m)Josephus排列的算法。 (2)试设计一个算法,对于给定的正整数n和1,2,…,n中的k个数。求正整数m,使 (n,m)Josephus排列的前k个数恰为事先指定的这k个数(顺序必须完全一样)。
Problem Description: Josephus ordered a new problem definition is as follows: Suppose n individuals arranged in a ring, given a positive integer m, from the first one Begins with individuals along the ring count, when confronted with the first m individuals let their out of line, then automatically add a calculator m, and the count continued into the OK go on. This process continues until all of them out of the column until the last person out of the column as a winner. This set up the individual numbers n Respectively, 1 ~ n, each number is one from the race have begun to count, then the order of each person out of the column is defined as an integer 1 ~ n An array. This arrangement is called a (n, m) Josephus arranged. For example, (7,3) Josephus arranged as 3,7,6,2,4,1,5. For a given 1,2, ..., n in the k-number, Josephus would like to know whether there is a positive integer m makes the (n, m) Josephus arranged in exactly the number of pre-k this for a pre-specified k number (2010-01-04, Visual C++, 2KB, 下载15次)

http://www.pudn.com/Download/item/id/1028723.html

[数据结构] 1

11. 停车场管理2(9) (1) 有一个两层的停车场, 每层有6个车位, 当第一层车停满后才允许使用第二层. ( 停车场可用一个二维数组实现, 每个数组元素存放一个车牌号 ) 每辆车的信息包括车牌号, 层号, 车位号, 停车时间共4项. 其中停车时间按分钟计算 (2) 假设停车场初始状态为第一层已经停有4辆车, 其车位号依次为1—4 , 停车时间依次为20, 15, 10 , 5 . 即先将这四辆车的信息存入文件”car.dat”中( 数组的对应元素也要进行赋值 ) (3) 停车操作: 当一辆车进入停车场时, 先输入其车牌号, 再为它分配一个层号和一个车位号(分配前先查询车位的使用情况, 如果第一层有空则必须停在第一层), 停车时间设为5 , 最后将新停入的汽车的信息添加文件”car.dat”中, 并将在此之前的所有车的停车时间加5. (4) 收费管理(取车): 当有车离开时, 输入其车牌号, 先按其停车时间计算费用, 每5分钟0.2元. (停车费用可设置一个变量进行保存), 同时从文件”car.dat”中删除该车的信息, 并将该车对应的车位设置为可使用状态(即二维数组对应元素清零). 按用户的选择来判断是否要输出停车收费的总计. (5) 输出停车场中全部车辆的信息. (6) 退出系统.
err (2008-06-16, Visual C++, 3KB, 下载8次)

http://www.pudn.com/Download/item/id/491249.html
总计:371