Geeks Talk

Prepare for your Next Interview




What approach you will follow?

This is a discussion on What approach you will follow? within the Analytical Skills forums, part of the Brain Gym category; 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 "...


Go Back   Geeks Talk > Brain Gym > Analytical Skills

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 09-27-2007
Moderator
 
Join Date: Sep 2006
Location: Delhi (India)
Posts: 859
Thanks: 12
Thanked 78 Times in 64 Posts
jainbrijesh is on a distinguished road
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.
__________________
Brijesh Jain
brijesh.tester@yahoo.co.in
http://softwaretestingexpertise.blogspot.com
Reply With Quote
The Following 3 Users Say Thank You to jainbrijesh For This Useful Post:
Sponsored Links
  #2 (permalink)  
Old 09-27-2007
Contributing Member
 
Join Date: Sep 2006
Location: bangalore, india
Posts: 1,007
Thanks: 0
Thanked 70 Times in 59 Posts
psuresh1982 will become famous soon enough
Re: What approach you will follow?

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

------------------------
suresh
Reply With Quote
The Following User Says Thank You to psuresh1982 For This Useful Post:
  #3 (permalink)  
Old 09-28-2007
Moderator
 
Join Date: Sep 2006
Location: Delhi (India)
Posts: 859
Thanks: 12
Thanked 78 Times in 64 Posts
jainbrijesh is on a distinguished road
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?
__________________
Brijesh Jain
brijesh.tester@yahoo.co.in
http://softwaretestingexpertise.blogspot.com
Reply With Quote
  #4 (permalink)  
Old 09-28-2007
Contributing Member
 
Join Date: Sep 2006
Location: bangalore, india
Posts: 1,007
Thanks: 0
Thanked 70 Times in 59 Posts
psuresh1982 will become famous soon enough
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
Reply With Quote
  #5 (permalink)  
Old 09-28-2007
Contributing Member
 
Join Date: Nov 2006
Location: India
Posts: 79
Thanks: 3
Thanked 14 Times in 9 Posts
j_madhuri is on a distinguished road
Re: What approach you will follow?

i will use binary search to find that integer.
Reply With Quote
  #6 (permalink)  
Old 09-29-2007
Moderator
 
Join Date: Sep 2006
Location: Delhi (India)
Posts: 859
Thanks: 12
Thanked 78 Times in 64 Posts
jainbrijesh is on a distinguished road
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.
__________________
Brijesh Jain
brijesh.tester@yahoo.co.in
http://softwaretestingexpertise.blogspot.com
Reply With Quote
  #7 (permalink)  
Old 09-30-2007
Junior Member
 
Join Date: Sep 2007
Posts: 5
Thanks: 1
Thanked 1 Time in 1 Post
doongarwal is on a distinguished road
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
Reply With Quote
The Following User Says Thank You to doongarwal For This Useful Post:
  #8 (permalink)  
Old 10-01-2007
Moderator
 
Join Date: Sep 2006
Location: Delhi (India)
Posts: 859
Thanks: 12
Thanked 78 Times in 64 Posts
jainbrijesh is on a distinguished road
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.
__________________
Brijesh Jain
brijesh.tester@yahoo.co.in
http://softwaretestingexpertise.blogspot.com
Reply With Quote
  #9 (permalink)  
Old 10-07-2007
Junior Member
 
Join Date: Sep 2007
Posts: 5
Thanks: 1
Thanked 1 Time in 1 Post
doongarwal is on a distinguished road
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
Reply With Quote
  #10 (permalink)  
Old 10-12-2007
Junior Member
 
Join Date: Jul 2007
Location: india
Posts: 15
Thanks: 2
Thanked 0 Times in 0 Posts
mcamuthu is on a distinguished road
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..
Reply With Quote
  #11 (permalink)  
Old 12-11-2007
Junior Member
 
Join Date: Dec 2007
Location: Coimbatore,Tamilnadu, India
Posts: 5
Thanks: 0
Thanked 1 Time in 1 Post
chibionos is on a distinguished road
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.
Reply With Quote
  #12 (permalink)  
Old 12-11-2007
Contributing Member
 
Join Date: Aug 2007
Posts: 67
Thanks: 9
Thanked 9 Times in 8 Posts
raj1402 is on a distinguished road
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
Reply With Quote
  #13 (permalink)  
Old 12-22-2007
Junior Member
 
Join Date: Dec 2007
Posts: 25
Thanks: 1
Thanked 4 Times in 4 Posts
sk_seeker is on a distinguished road
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.
Reply With Quote
  #14 (permalink)  
Old 07-09-2008
Junior Member
 
Join Date: Jul 2008
Location: Pune
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
namratag is on a distinguished road
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...
Reply With Quote
Reply

  Geeks Talk > Brain Gym > Analytical Skills


Thread Tools
Display Modes


Similar Threads

Thread Thread Starter Forum Replies Last Post
What approach should I take sunnysunny57 Career Advice 1 10-25-2007 02:43 AM
Component driven and keyword driven framework approach Geek_Guest SilkTest 0 07-10-2007 12:42 PM
Best approach to recognize the objects JobHelper QTP 2 12-27-2006 02:29 AM


All times are GMT -4. The time now is 08:04 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2008 GeekInterview.com. All Rights Reserved