由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - C#: Array 1 sort成 Array 2, 怎么从Array 2里的element idx找到原先的idx ?
相关主题
在两个sorted array里找median问一个leetcode的排序问题
问大家一个C语言编程的小问题ask a c question
C# 的不定长度的ARRAY?a simple question
也问个二维数组的函数传递问题A question about sharing data inside a C++ class
新手学JAVA,遇到一个难题,有大侠愿意帮忙吗?请教改numpy array的dtype
How to compare data in an Array and in Xml (转载)Interview question
about layout of List in C#算法问题
一FG家常见题 (转载)两个矩阵的算法题
相关话题的讨论汇总
话题: array话题: idx话题: c#话题: actually话题: function
进入Programming版参与讨论
1 (共1页)
s*****w
发帖数: 1527
1
say
Array 1 = {1, 3, 2, 4}, idx is 0, 1 ,2 3
Array 2 = {1, 2, 3, 4}
how do i know it's idx is actually 0, 2, 1, 3 from Array 1 ?
is there such function ?
N***m
发帖数: 4460
2
how about sorting the corresponding map?

【在 s*****w 的大作中提到】
: say
: Array 1 = {1, 3, 2, 4}, idx is 0, 1 ,2 3
: Array 2 = {1, 2, 3, 4}
: how do i know it's idx is actually 0, 2, 1, 3 from Array 1 ?
: is there such function ?

c**t
发帖数: 2744
3
var qry = from b in Array2
select Array.IndexOf(Array1, b);

say
Array 1 = {1, 3, 2, 4}, idx is 0, 1 ,2 3
Array 2 = {1, 2, 3, 4}
how do i know it's idx is actually 0, 2, 1, 3 from Array 1 ?
is there such function ?

【在 s*****w 的大作中提到】
: say
: Array 1 = {1, 3, 2, 4}, idx is 0, 1 ,2 3
: Array 2 = {1, 2, 3, 4}
: how do i know it's idx is actually 0, 2, 1, 3 from Array 1 ?
: is there such function ?

s*****w
发帖数: 1527
4
兄弟,你牛!

【在 c**t 的大作中提到】
: var qry = from b in Array2
: select Array.IndexOf(Array1, b);
:
: say
: Array 1 = {1, 3, 2, 4}, idx is 0, 1 ,2 3
: Array 2 = {1, 2, 3, 4}
: how do i know it's idx is actually 0, 2, 1, 3 from Array 1 ?
: is there such function ?

l********f
发帖数: 149
5
Linq just looks fancy, underneath the hood it still doing two foreach loop and complexity for this algo is O(n2).
Correct me if i am wrong.

【在 c**t 的大作中提到】
: var qry = from b in Array2
: select Array.IndexOf(Array1, b);
:
: say
: Array 1 = {1, 3, 2, 4}, idx is 0, 1 ,2 3
: Array 2 = {1, 2, 3, 4}
: how do i know it's idx is actually 0, 2, 1, 3 from Array 1 ?
: is there such function ?

1 (共1页)
进入Programming版参与讨论
相关主题
两个矩阵的算法题新手学JAVA,遇到一个难题,有大侠愿意帮忙吗?
Please recommend a book on .NET, C#How to compare data in an Array and in Xml (转载)
C# 的一些新feature.about layout of List in C#
database access using C# .net2008 3.5, window form一FG家常见题 (转载)
在两个sorted array里找median问一个leetcode的排序问题
问大家一个C语言编程的小问题ask a c question
C# 的不定长度的ARRAY?a simple question
也问个二维数组的函数传递问题A question about sharing data inside a C++ class
相关话题的讨论汇总
话题: array话题: idx话题: c#话题: actually话题: function