@saurabh
u are getting sizeof(a)/sizeofa[0] =1 coz fiest one is pointer and second
one is integer...both's size is 4
do it
without passing
http://www.ideone.com/8olTP

On Tue, Aug 23, 2011 at 1:28 PM, vikas <vikas.rastogi2...@gmail.com> wrote:

> nopes, you need to know where the hell it ends.... even if this is a
> string , it ends with convention of ending 0. in case it is stream ,
> we know the data length. in case of array, above mentioned approach
> should work. sizeof(arr)/sizeof(arr[0])
>
> if you are given only a pointer and no length, you can address until
> there is another page starts in memory , not belonging to the process.
>
>
>
>
> On Aug 23, 7:07 am, saurabh singh <saurab...@gmail.com> wrote:
> > Just a small code to back up my point...http://www.ideone.com/woRiT
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > On Tue, Aug 23, 2011 at 7:33 AM, saurabh singh <saurab...@gmail.com>
> wrote:
> > > That would take all the fun away....what if you are given only the
> address
> > > of the array?This wont work in that case
> >
> > > On Mon, Aug 22, 2011 at 10:39 PM, asdqwe <ayushgoel...@gmail.com>
> wrote:
> >
> > >> If i am not wrong, the only possible solution can be
> > >> len=sizeof(arr)/sizeof(arr[0])
> > >> i.e. find the length from the array itself.
> >
> > >> On Aug 22, 9:01 pm, saurabh singh <saurab...@gmail.com> wrote:
> > >> > @dave or anyone??????? response please
> >
> > >> > On Sun, Aug 21, 2011 at 12:43 PM, saurabh singh <
> saurab...@gmail.com>
> > >> wrote:
> > >> > > kkk...not sure
> > >> > > assume no number is greater than 1000(I mentioned There has to be
> some
> > >> > > additional constraints to make the problem solvable)....
> > >> > > Now check 1st element if not the desired element keep multiplying
> with
> > >> 2
> > >> > > the previous range till either one of these condition is satisfied
> > >> > > *1.An exception is caught*
> > >> > > *2.Number greater than 1000 occurs.*
> > >> > > suppose this happens for *1024 *for the given example.
> > >> > > then we will check out for (512+1024)/2 th element for the above
> > >> condition.
> > >> > > If true than again branch like binary search.This way can element
> > >> which on
> > >> > > left side doesn't gives any exception and maintains the
> constraints
> > >> while on
> > >> > > the right it violates the same.So we may land up with the desired
> > >> index and
> > >> > > can then perform binary search.......
> >
> > >> > > PS:There are lots of assumption in this approach and the more I
> write
> > >> the
> > >> > > more I get convinced that its a plain stupid idea...
> >
> > >> > > --
> > >> > > Saurabh Singh
> > >> > > B.Tech (Computer Science)
> > >> > > MNNIT ALLAHABAD
> >
> > >> > --
> > >> > Saurabh Singh
> > >> > B.Tech (Computer Science)
> > >> > MNNIT ALLAHABAD
> >
> > >> --
> > >> You received this message because you are subscribed to the Google
> Groups
> > >> "Algorithm Geeks" group.
> > >> To post to this group, send email to algogeeks@googlegroups.com.
> > >> To unsubscribe from this group, send email to
> > >> algogeeks+unsubscr...@googlegroups.com.
> > >> For more options, visit this group at
> > >>http://groups.google.com/group/algogeeks?hl=en.
> >
> > > --
> > > Saurabh Singh
> > > B.Tech (Computer Science)
> > > MNNIT ALLAHABAD
> >
> > --
> > Saurabh Singh
> > B.Tech (Computer Science)
> > MNNIT ALLAHABAD
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
**Regards
SAGAR PAREEK
COMPUTER SCIENCE AND ENGINEERING
NIT ALLAHABAD

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to