Results 1 to 14 of 14

Thread: What approach you will follow?

  1. #1
    Moderator
    Join Date
    Sep 2006
    Answers
    920

    What approach you will follow?

    There is an array of 100 integers.There is an integer 48 in the array which is now changed to "0".How you will find out that "0".What approach you will follow?

    Plz. note :- It's an analytical question.
    Don't write and code here.


    Regards,
    Brijesh Jain
    ---------------------------------------------------------
    Connect with me on Skype: jainbrijesh
    Google Plus : jainbrijeshji

  2. #2
    Contributing Member
    Join Date
    Sep 2006
    Answers
    962

    Re: What approach you will follow?

    How can you found the "48"?. Use the same approach to find "0".

    ------------------------
    suresh


  3. #3
    Moderator
    Join Date
    Sep 2006
    Answers
    920

    Re: What approach you will follow?

    Thanks suresh.

    But we can't answer like that.We have to tell some approach, It may be related to programming concepts also.But main things in logic you will follow, that's what I want to know?

    Regards,
    Brijesh Jain
    ---------------------------------------------------------
    Connect with me on Skype: jainbrijesh
    Google Plus : jainbrijeshji

  4. #4
    Contributing Member
    Join Date
    Sep 2006
    Answers
    962

    Re: What approach you will follow?

    In Data Structure one sorting order is there. That name is Quick Sort. Using that approach i will find the number.

    ------------------------
    suresh


  5. #5
    Contributing Member
    Join Date
    Nov 2006
    Answers
    76

    Re: What approach you will follow?

    i will use binary search to find that integer.


  6. #6
    Moderator
    Join Date
    Sep 2006
    Answers
    920

    Re: What approach you will follow?

    Quote Originally Posted by psuresh1982 View Post
    In Data Structure one sorting order is there. That name is Quick Sort. Using that approach i will find the number.

    ------------------------
    suresh
    Quick sort is used for sorting the array, not to find out an element from the array.

    Regards,
    Brijesh Jain
    ---------------------------------------------------------
    Connect with me on Skype: jainbrijesh
    Google Plus : jainbrijeshji

  7. #7
    Junior Member
    Join Date
    Sep 2007
    Answers
    4

    Re: What approach you will follow?

    Quote Originally Posted by jainbrijesh View Post
    There is an array of 100 integers.There is an integer 48 in the array which is now changed to "0".How you will find out that "0".What approach you will follow?

    Plz. note :- It's an analytical question.
    Don't write and code here.
    " just compare each data in array with '0' the one changed will reflct itself



  8. #8
    Moderator
    Join Date
    Sep 2006
    Answers
    920

    Re: What approach you will follow?

    Quote Originally Posted by doongarwal View Post
    " just compare each data in array with '0' the one changed will reflct itself
    But it may be case that there is already other zero entries are there in the array.Because no where it has been told that there is no zero entry.

    Regards,
    Brijesh Jain
    ---------------------------------------------------------
    Connect with me on Skype: jainbrijesh
    Google Plus : jainbrijeshji

  9. #9
    Junior Member
    Join Date
    Sep 2007
    Answers
    4

    Re: What approach you will follow?

    Quote Originally Posted by jainbrijesh View Post
    But it may be case that there is already other zero entries are there in the array.Because no where it has been told that there is no zero entry.
    then first we need to find tht where was tht 48 b/c 48 can also be many
    which 48
    so location of it
    or there may be smthing which will tell us the recent update last made
    as if we see the case of stacks the last updation made will come first
    so can we use tht approch in programing from intially then we can ealisy find it out
    hoe so u got wht i mean
    chalo anywy thks for reply


  10. #10
    Junior Member
    Join Date
    Jul 2007
    Answers
    14

    Re: What approach you will follow?

    Quote Originally Posted by doongarwal View Post
    then first we need to find tht where was tht 48 b/c 48 can also be many
    which 48
    so location of it
    or there may be smthing which will tell us the recent update last made
    as if we see the case of stacks the last updation made will come first
    so can we use tht approch in programing from intially then we can ealisy find it out
    hoe so u got wht i mean
    chalo anywy thks for reply

    simply concept but we didn't thing about that..


  11. #11
    Junior Member
    Join Date
    Dec 2007
    Answers
    5

    Re: What approach you will follow?

    Hai guys i am new to the Game..
    But i think i have a fair answer.

    When a search happens to find the '48' then its probably from the start.
    and the change in the 48 to 0 is made assuming the search is from the start and that we dont have any data to recover the past actions that are carried out in the array.

    So as i was saying the '48' that is changed to '0' will be among the 0's that are present from the start of the array and the probablity of a 0 begin 48 will decrease when we move further towards the end of the array.

    If the Direction of the search is known then this method will give a high probability of finding the changed location.


  12. #12
    Contributing Member
    Join Date
    Aug 2007
    Answers
    59

    Re: What approach you will follow?

    we can compare old array elements with new one if there is a change we can find
    assuming we know old array elements


  13. #13
    Contributing Member
    Join Date
    Dec 2007
    Answers
    46

    Re: What approach you will follow?

    Quote Originally Posted by jainbrijesh View Post
    There is an array of 100 integers.There is an integer 48 in the array which is now changed to "0".How you will find out that "0".What approach you will follow?

    Plz. note :- It's an analytical question.
    Don't write and code here.
    Hmm... is this a trick question

    "0" i.e. string zero. i.e. it is a pointer. So, you have replaced an integer of 48 by an address. Assuming this, you might see a huge value. Maybe this will help us find the replaced 48?? But, this is not a guarantee as we could have a huge integer value among the remaining 99 integers.

    If you did not mean string zero, then I would ask if the elements were sorted. If it were, then I would search for the first 48 and searching until I hit a number greater than 48. If there are multiple 48s, just find the one that has been zeroed before we hit a number greater than 48.


  14. #14
    Junior Member
    Join Date
    Jul 2008
    Answers
    1

    Re: What approach you will follow?

    Hey guys what i think is..
    we can just sum up old array.. let it be x..
    not sum up new array.. it will be y..
    so if the diff is 48.. (x-y = 48)
    then that element is 0..
    if difference is something else.. say z..
    then number is 48-z...


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact