Advertisement

07.10.2008 at 07:24PM PDT, ID: 23556089
[x]
Attachment Details

whats the best way to find a repetitive number in an array

Asked by precado999 in C# Programming Language

Tags: C#, Visual Studio 2008

hi to all, lets say that I have an array of ten numbers. one of the numbers is repeated what would be the most efficient way to find that number.

my idea is to copy the array and then sort it by numerical order then I would compare the two arrays to find which number is repeated am I in the right track?Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
public static void Main()
        {
            
            int[] nums = new int[10] {20, 2, 3, 55, 33, 44, 55, 66, 88, 2};            
            MyClass numClass = new MyClass();
            numClass.findNum(nums);           
           
        }
 class MyClass
    {
        public void findNum(int[] array1)
        {
            for (int i = 0; i < 10; i++)
            {
                for (int c = 0; c < 10; c++)
 
            }
        }
    }
 
 
[+][-]07.10.2008 at 07:32PM PDT, ID: 21979498

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]07.10.2008 at 07:38PM PDT, ID: 21979538

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]07.10.2008 at 07:40PM PDT, ID: 21979548

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]07.10.2008 at 07:41PM PDT, ID: 21979555

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.10.2008 at 07:47PM PDT, ID: 21979588

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.10.2008 at 07:50PM PDT, ID: 21979599

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: C# Programming Language
Tags: C#, Visual Studio 2008
Sign Up Now!
Solution Provided By: jaime_olivares
Participating Experts: 2
Solution Grade: A
 
 
[+][-]07.10.2008 at 07:54PM PDT, ID: 21979614

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628