本文介绍了修剪线性单链表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述






我有一个包含100个元素的线性单链表。我想

修剪它[即删除一些节点],使得只有用户指定的元素

(仅说原始列表中的元素1,13,78和100)修剪后生存




有人能告诉我怎么做吗?我是一名科学家,而不是一名计算机工程师/学生。这将有助于我在

数据分析中开发一个应用程序。我将非常感谢你的建议。


干杯,

Anand。

解决方案



-

Nick Keighley


我们建议,相反,用户可以利用GNU C的扩展,并忽略其他编译器的限制。除了

某些超级计算机和过时的小型机器之外,使用除了

bootstrapping之外的任何其他C编译器的原因更少

。 GNU CC。

(使用和移植GNU CC)






我很想看到有关此问题的一些讨论。我一直在改变我对是否使用扩展的看法。我最近决定开始使用扩展,并用

__extension__标记它们,并且不再担心它。但我一直在担心

它。目前,我正在使用的唯一扩展是微不足道的 - 枚举

带有尾随逗号,结构中未命名的联盟(我是否正确?

称这个微不足道? ),很少有typeof关键字。我用gcc独家工作

,虽然我试图保持在

标准范围内,但我真正拥有的唯一执行机制是-pedantic,

所以我知道所有我完全标准的努力都是浪费了b $ b。我想更频繁地开始使用typeof,但我不愿意这样做。
这样做。有没有办法判断哪些扩展被认为是

更可接受(即更可能被纳入标准)

比其他扩展?



Hi,

I have a linear singly linked list of 100 elements. I would like to
prune it [i.e delete some nodes] such that only user specified elements
(say only the elements 1, 13, 78 and 100 of the original list) survive
after pruning.

Can somebody show me how to do this ? I am a scientist and not a
computer engineer/student. This will help me develop an application in
data analysis. I will be grateful for your advice.

Cheers,
Anand.

解决方案


--
Nick Keighley

We recommend, rather, that users take advantage of the extensions of
GNU C and disregard the limitations of other compilers. Aside from
certain supercomputers and obsolete small machines, there is less
and less reason ever to use any other C compiler other than for
bootstrapping GNU CC.
(Using and Porting GNU CC)





I would love to see some discussions about this. I''m constantly
changing my mind about whether or not to use extensions. I most
recently decided to start using extensions, marking them with
__extension__, and stop worrying about it. But I keep worrying about
it. At the moment, the only extensions I''m using are trivial-- enums
with trailing commas, unnamed unions within structures (Am I correct in
calling that trivial?), and very rarely the typeof keyword. I work
exclusively with gcc, and although I''m trying to remain within
standards, the only enforcement mechanism I really have is -pedantic,
so for all I know all of my efforts to be completely standard are
wasted. I''d like to start using typeof more often, but am reluctant to
do so. Is there a way to deteremine which extensions are considered
more acceptable (ie more likely to be incorporated into the standard)
than others?


这篇关于修剪线性单链表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 21:16