KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Problem: I have two arrays that can possibly be different lengths. I need to iterate through both arrays and find similarities, additions, and deletions. What's the fastest and most efficient way to accomplish this in C#? Edit: The arrays are pre-sorted and they can contain anywhere between 50-100 items. Also, there aren't any constraints on speed and/or memory usage (however, no one likes a memory hog;) For example: String[] Foo_Old = {"test1", "test2", "test3"}; String[] Foo_New = {"test1", "test2", "test4", "test5"}; AND String[] Bar_Old = {"test1", "test2", "test4"}; String[] Bar_New = {"test1", "test3"}; Differences: (with respect to the Foo_New array) [Same] "test1" [Same] "test2" [Removed] "test3" [Added] "test4" [Added] "test5" (with respect to the Bar_New array) [Same] "test1" [Removed] "test2" [Removed] "test4" [Added] "test3"
Tags (comma-separated)
Save Edits
Cancel