且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

二叉树

更新时间:2022-10-17 17:46:09



Foodbank schreef:
大家好,

我正在尝试进行二进制搜索并从文本
文件中收集一些统计信息,以便比较此程序(二进制
搜索)与使用链接列表的旧程序的处理时间。


A二分搜索不涉及任何树木,它是通过*排序*顺序列表搜索

的方式。

我完全是新的二进制搜索方式。任何人都可以帮助我评论下面的评论部分吗?很多代码如函数和printfs已经完成了。


是的。除了树木构建的实际实施和

搜索算法之外的所有内容都留给了学生。我打赌那就是

老师给你的作业。

非常感谢任何帮助。
/ ****添加新节点和计数重复的代码***** /
< snip> / *****代码执行二进制SRCH ***** /
< snip> / *****收集所有统计数据的回复代码***** /




做自己的作业,或者至少让我们看你尝试。




Foodbank写道:
大家好,

我正在尝试进行二进制搜索并从文本
文件中收集一些统计信息,以便比较此程序的处理时间(二进制
搜索)与旧程序的比较使用链接列表。顺便说一句,我对二进制搜索是全新的。任何人都可以帮助我评论下面的评论部分吗?


这里有一些关于二叉树如何工作的链接。这是关于Collat​​z序列中的数字

而不是单词,但适用相同的原则。

事实上,我从O''Reilly学会了如何做到这一点书实用

C编程示例处理单词列表。

解决方案

我谈到使用三指针结构,允许我创建一个二进制树同时是一个链表。

。如果它不适用于您的问题,请忽略第三个

指针功能。


这是关于二叉树的快速教程


< http://groups.google.com/group/Dymanic_Systems/browse_frm/thread/40b6e1f3d696be54/cb42098abc4cf84e?hl = zh-CN#cb42098abc4cf84e>


这个是二叉树如何适用于在Collat​​z序列中找到重复数字的问题。


< http://groups.google。 com / group / Dymanic_Systems / browse_frm / thread / 43c11da057cfb30c / 6f35e1f30e0a3b43?hl = en#6f35e1f30e0a3b43>


如果这些都没有任何意义,我可以挖掘我的代码示例,

但是现在它们被编码为使用GMP无限精度整数

并且不会直接插入你的程序,但原则应该是

适用。

很多代码如函数和printfs已经完成了。非常感谢任何帮助。

谢谢,


展开 | 选择 | 换行 | 行号



me********@aol.com 写道:

Foodbank写道:
大家好,

我正在尝试二进制搜索并从文本
文件中收集一些统计信息为了比较这个程序的处理时间(二进制
搜索)与使用链接列表的旧程序。顺便说一句,我对二进制搜索是全新的。任何人都可以帮助我使用下面评论的
部分吗?
这里有一些关于二叉树如何工作的链接。这是关于Collat​​z序列中的数字而不是单词,但同样的原则也适用。
实际上,我从O''Reilly的书Practical
中学到了如何做到这一点。 C编程示例处理单词列表。
解决方案
我谈到使用三指针结构,允许我创建一个同时是链表的二叉树。如果它不适用于你的问题,请忽略第三个
指针功能。

这是关于二叉树的快速教程

< http:// groups.google.com/group/Dymanic_Systems/browse_frm/thread/40b6e1f3d696be54/cb42098abc4cf84e?hl=zh-CN#cb42098abc4cf84e>

这就是二叉树适用于查找问题的方法Collat​​z序列中的重复数字。

< http://groups.google.com/group/Dymanic_Systems/browse_frm/thread/43c11da057cfb30c/6f35e1f30e0a3b43?hl = en#6f35e1f30e0a3b43>




这些链接将您带到线程的末尾。我的意思是你在每个帖子中读取



的第一条消息(其他人偏离主题

虽然

你当然欢迎阅读它们。)


如果没有任何意义,我可以挖掘我的代码示例,
但是现在他们编码使用GMP无限精度整数
并且不会直接插入你的程序,但原则应该适用。

大部分代码如此因为函数和printfs已经完成了。非常感谢任何帮助。

谢谢,


展开 | 选择 | 换行 | 行号


Hi all,

I''m trying to do a binary search and collect some stats from a text
file in order to compare the processing times of this program (binary
searching) versus an old program using linked lists. I''m totally new
to binary searches by the way. Can anyone help me with the commented
sections below? Much of the code such as functions and printfs has
already been completed. Any help is greatly appreciated.

Thanks,
James

Expand|Select|Wrap|Line Numbers


Foodbank schreef:
Hi all,

I''m trying to do a binary search and collect some stats from a text
file in order to compare the processing times of this program (binary
searching) versus an old program using linked lists.
A "binary search" does not involve any trees, it''s a way of searching
through *sorted* sequential lists.
I''m totally new
to binary searches by the way. Can anyone help me with the commented
sections below? Much of the code such as functions and printfs has
already been completed.
Yes. All but the actual implementation of the tree-building and
searching algo''s, which are left to the student. I bet that''s what the
teacher gave you as an assignment.
Any help is greatly appreciated. /****CODE TO ADD NEW NODES AND COUNT REPEATS *****/ <snip>/***** CODE TO DO THE BINARY SRCH *****/ <snip>/***** RECURSIVE CODE TO COLLECT ALL OF THE STATISTICS *****/



Do your own homework, or at least let us see you trying.



Foodbank wrote:
Hi all,

I''m trying to do a binary search and collect some stats from a text
file in order to compare the processing times of this program (binary
searching) versus an old program using linked lists. I''m totally new
to binary searches by the way. Can anyone help me with the commented
sections below?
Here''s a couple links to how binary trees work. It''s about numbers
in a Collatz sequence instead of words but the same principles apply.
In fact, I learned how to do this from the O''Reilly book "Practical
C Programming" where the example processes a list of words. The
solution
I talk about uses a three pointer structure that allows me to create
a binary tree that is simultaneously a linked list. Ignore that third
pointer feature if it''s not applicable to your problem.

This is a quickie tutorial on binary trees

<http://groups.google.com/group/Dymanic_Systems/browse_frm/thread/40b6e1f3d696be54/cb42098abc4cf84e?hl=en#cb42098abc4cf84e>

And this is how a binary tree is applicable to the problem of
finding a duplicate number in a Collatz sequence.

<http://groups.google.com/group/Dymanic_Systems/browse_frm/thread/43c11da057cfb30c/6f35e1f30e0a3b43?hl=en#6f35e1f30e0a3b43>

If none of this makes any sense, I can dig up my code examples,
but right now they are coded to use GMP unlimited precision integers
and won''t directly plug into your program, but the principles should
apply.
Much of the code such as functions and printfs has
already been completed. Any help is greatly appreciated.

Thanks,
James

Expand|Select|Wrap|Line Numbers



me********@aol.com wrote:
Foodbank wrote:
Hi all,

I''m trying to do a binary search and collect some stats from a text
file in order to compare the processing times of this program (binary
searching) versus an old program using linked lists. I''m totally new
to binary searches by the way. Can anyone help me with the commented
sections below?
Here''s a couple links to how binary trees work. It''s about numbers
in a Collatz sequence instead of words but the same principles apply.
In fact, I learned how to do this from the O''Reilly book "Practical
C Programming" where the example processes a list of words. The
solution
I talk about uses a three pointer structure that allows me to create
a binary tree that is simultaneously a linked list. Ignore that third
pointer feature if it''s not applicable to your problem.

This is a quickie tutorial on binary trees

<http://groups.google.com/group/Dymanic_Systems/browse_frm/thread/40b6e1f3d696be54/cb42098abc4cf84e?hl=en#cb42098abc4cf84e>

And this is how a binary tree is applicable to the problem of
finding a duplicate number in a Collatz sequence.

<http://groups.google.com/group/Dymanic_Systems/browse_frm/thread/43c11da057cfb30c/6f35e1f30e0a3b43?hl=en#6f35e1f30e0a3b43>



These links take you to the end of the threads. I meant for you to read
the
first message in each thread (the others drift away from the subject
although
you''re certainly welcome to read them).


If none of this makes any sense, I can dig up my code examples,
but right now they are coded to use GMP unlimited precision integers
and won''t directly plug into your program, but the principles should
apply.

Much of the code such as functions and printfs has
already been completed. Any help is greatly appreciated.

Thanks,
James

Expand|Select|Wrap|Line Numbers


登录 关闭
扫码关注1秒登录
二叉树
发送“验证码”获取 | 15天全站免登陆
上一篇 : :UITabBar定制下一篇 : 如何在选项卡中插入选项卡

相关阅读

技术问答最新文章