The Gateway to Computer Science Excellence

+1 vote

An array of unknown size is filled with special symbols let's say '#'. Time required to find the size of array is

1) O(1)

2) O(logn)

3) O(n)

4) O((logn)^{2})

0

I think it would take O(logn)

Traverse it exponentially, i.e traverse with modification in Binary search

Traverse it exponentially, i.e traverse with modification in Binary search

0

let

S is an array...then...let starting address is 100 and having 5 element of 1 byte...then

&S+1 will return 100+5*1=105....now conside.. S=100

calculate....105-100= **5/size of an element .....**

**and for given question this ia character...therefro we will assume size is 1 byte..**

0

1 -> 2 -> 4 -> 8 -> 16 ->32 ...... -> 1024

Now, If the last element is 513 (OR 1023 OR 768 whichever is the worst case), then how to proceed?

Now, If the last element is 513 (OR 1023 OR 768 whichever is the worst case), then how to proceed?

0

- All categories
- General Aptitude 1.9k
- Engineering Mathematics 7.5k
- Digital Logic 2.9k
- Programming and DS 4.9k
- Algorithms 4.4k
- Theory of Computation 6.2k
- Compiler Design 2.1k
- Databases 4.1k
- CO and Architecture 3.4k
- Computer Networks 4.2k
- Non GATE 1.4k
- Others 1.4k
- Admissions 595
- Exam Queries 573
- Tier 1 Placement Questions 23
- Job Queries 72
- Projects 18

50,737 questions

57,314 answers

198,358 comments

105,085 users