编写代码以从c#.net中的未排序链接列表中删除重复项 [英] Write a code to remove duplicates from an unsorted Linked List in c#.net

查看:107
本文介绍了编写代码以从c#.net中的未排序链接列表中删除重复项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编写代码以从c#.net

Write a code to remove duplicates from an unsorted Linked List in c#.net

推荐答案

中未分类的链接列表中删除重复项。我们不做您的作业:它是有原因的。它就是为了让你思考你被告知的事情,并试着理解它。它也在那里,以便您的导师可以识别您身体虚弱的区域,并将更多的注意力集中在补救措施上。



亲自尝试,你可能会发现它不是你想的很难!
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!


很简单 - 为什么不开始,发布你在这里做的,并问我们一个具体的问题



这里足以让你入门(它只有一种可能的方式)



a)遍历/迭代你的源/副本/未排序的列表,对于任何元素的列表中的所有元素,检查一个合适的数据结构以查看该元素是否存在

c)对于任何存在的元素,可能添加如果您选择了正确的数据结构,当您完成遍历源/重复/未排序列表时,插入元素的计数为'1'

d)在(b),您有一个唯一条目列表,并计算那些ma的条目他们被看到了ny次(有时很有用)



'g'
its pretty easy - why dont you make a start, post what you've done here, and ask us a specific question

here's enough to get you started (its only one way out of oodles of possibilities)

a) traverse/iterate your source/duplicate/unsorted list, for all elements in the list
b) for any element, check a suitable data structure to see if the element exists
c) for any element that exists, maybe add one to the count for that item, else, insert the element with a count of '1'
d) when you're finished traversing your source/duplicate/unsorted list, if you chose the correct data structure at (b), you then have a list of unique entries, and counts for those entries of how many times they were seen (sometimes useful)

'g'


这篇关于编写代码以从c#.net中的未排序链接列表中删除重复项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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