Jump to content

some difficult one's

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
dixiragh

dixiragh

    Newbie

  • Members
  • Pip
  • 3 posts
//there is an array of size N in which every number is between 1 and N , determine if there are any duplicates in it.

// I'll try to do it in O(N) w/o using any additional memory. the key is to use content of the array as index into array.

// checking in O(1) if that number has been seen already.

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Given that this is homework, what is your question about it?
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
cdg10620

cdg10620

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 389 posts
Forum != PrivateTutor

While( !User.hasAnswer )
{
     User.askQuestion();

     if( User.postCode && User.putForthEffort )
     {
          CodeCallMembers.Help();
          User.hasAnswer = true;
     }
     else
     {
          CodeCallMembers.Laugh();
     }
}

-CDG10620
Software Developer