- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
算法与数据结构习题答案(Algorithm and data structure problem answer)
算法与数据结构习题答案(Algorithm and data structure problem answer)
How many nodes do you need to move on average to insert and delete a node in a sequential table? What are the two factors?
A:
In the case of equal probability, the insertion of a node in the order table requires an average of n / 2 nodes. The deletion of a node requires an average move (n - 1) / 2 nodes. The specific number of moves depends on the length of the order table and the position I need to insert or delete. The closer I get to n, the less I need to move.
3.12 said known by singly linked lists of linear table, contains three types of characters of data elements (such as: alphabetic characters, Numbers, characters and other characters), try to write algorithm to construct linear table of three said in a circular linked list, each table contains only the same kind of character, and make use of the primary node space in a table as a node of the three table space, head node can be another space.
Solution:
To solve this problem, as long as three new head node, then in turn in the original singly linked lists of query, find the kind of character nodes, nodes link to the corresponding head took off this just indicate the new list.
The algorithm is as follows:
/ / set the empty circular list A, B, C and A, B and C of the three leading nodes.
Void DivideList (LinkList L, LinkList A, LinkList B, LinkList C)
{
ListNode * p = L - next, * q;
While (p)
{
If (p - data = a p - data = z | | p - data = a p - data = z)
{
Q = p - next;
P = p - next; / / point to the next node
Q - next = A - next; / / link the letter of the letter to A table
A - next = q; A = q;
}
Else if (p- data = 0 p - data = 9)
{/ / the digital nodes
Q = p - next;
P = p - next; / / point to the next node
Q - next = B - next; / / link the number node to the B table
B - next = q; B = q;
}
Else {/ / separated other character nodes
Q = p - next;
P = p - next; / / point to the next node
Q - next = C - next; / / link the other n
您可能关注的文档
- 日本神话1(Japan myth 1).doc
- 日语字面难解单词总汇(The Japanese language is literally difficult to understand).doc
- 日语拨音(Japanese dial tone).doc
- 日语音标(Japanese phonetic symbol).doc
- 时差计算(The time difference calculation).doc
- 时空新理论——空子理论(The new theory of space-time -- the theory of space).doc
- 时评评论央视(Commentary CCTV).doc
- 日语学科(Japanese subjects).doc
- 时间管理——如何应对外界的干扰(Time management - how to deal with external distractions).doc
- 时间跳跃(Time to jump).doc
- 算法期末参考(Algorithm final reference).doc
- 算法分析与设计复习资料(Algorithm analysis and design review data).doc
- 管理03(Management 03).doc
- 管理1324(Management, 1324).doc
- 管理故事鲶鱼效应(Management story catfish effect).doc
- 管理统计学1-3(Management statistics 1-3).doc
- 管螺纹表示方法(The pipe thread representation method).doc
- 篮球技巧(Basketball skills).doc
- 粒子的建立(Establishment of particles).doc
- 管理软件(Management software).doc
文档评论(0)