拆分链表 [英] Split Linked list

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

问题描述

我是新的C编程,我还挺需要一些帮助在 frontBackSplitLinkedList 部分,

I'm new to C programming and I kinda need some help in the frontBackSplitLinkedList part,

例如,假定给定的链接列表是:2 6 7 8 9
所得正面和背面分别是:
正面:2 6 7
回:8 9

For example, assume that given linked list is: 2 6 7 8 9 The resulting front and back are: front: 2 6 7 back: 8 9

我已经通过一些网站搜查,但大部分的编码都是使用的,而不是链表的节点。

I've searched through some websites but most of the codings are using nodes instead of linked list.

任何想法如何做到这一点?谢谢!

Any idea how to do this? Thank you!

推荐答案

您实际上并不指望在列表中的元素,据我看到它,你保存在_linkedlist元素的数量。您可以随时使用该值拆分但是你喜欢。我强烈建议先simlify您的清单,因此它只能到背部或列表的前面,它会更容易与它的工作添加元素,但不会真正影响分裂功能的原则。

You do not actually have to count elements in list, as far as i see it, you store the number of elements in _linkedlist. You can always use that value to split however you like. I would strongly suggest to first simlify your List, so it can add elements only to the back or the front of the List, it will be easier to work with it, but won't really affect the principle of split function.

这篇关于拆分链表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆