search
Log In

Recent questions tagged arrays

1 vote
2 answers
1
Let $A$ be an array of $31$ numbers consisting of a sequence of $0$’s followed by a sequence of $1$’s. The problem is to find the smallest index $i$ such that $A[i]$ is $1$ by probing the minimum number of locations in $A$. The worst case number of probes performed by an optimal algorithm is $2$ $4$ $3$ $5$
asked Mar 30 in Algorithms Lakshman Patel RJIT 62 views
0 votes
2 answers
2
If $x$ is a one dimensional array, then $^*(x+i)$ is same as $^*(\&x[i])$ $\&x[i]$ is same as $x+i-1$ $^*(x+i)$ is same as $^*x[i]$ $^*(x+i)$ is same as $^*x+i$
asked Mar 30 in Programming Lakshman Patel RJIT 126 views
0 votes
5 answers
3
Which of the following is true for computation time in insertion, deletion and finding maximum and minimum element in a sorted array ? Insertion - $0(1)$, Deletion - $0(1)$, Maximum - $0(1)$, Minimum - $0(1)$ Insertion - $0(1)$, Deletion - $0(1)$, Maximum - $0(n)$, Minimum - $0(n)$ ... , Maximum - $0(1)$, Minimum - $0(1)$ Insertion - $0(n)$, Deletion - $0(n)$, Maximum - $0(n)$, Minimum - $0(n)$
asked Mar 24 in Algorithms jothee 100 views
2 votes
5 answers
4
Consider a $2$-dimensional array $x$ with $10$ rows and $4$ columns, with each element storing a value equivalent to the product of row number and column number. The array is stored in row-major format. If the first element $x[0][0]$ occupies the memory location with ... location, which all locations (in decimal) will be holding a value of $10$? $1018,1019$ $1022,1041$ $1013,1014$ $1000,1399$
asked Jan 13 in DS Satbir 1k views
4 votes
3 answers
5
What is the output of the code given below? # include<stdio.h> int main() { char name[]="satellites"; int len; int size; len= strlen(name); size = sizeof(name); printf("%d",len*size); return 0; } $100$ $110$ $40$ $44$
asked Jan 13 in Programming Satbir 534 views
1 vote
1 answer
6
Given an array of ( both positive and negative ) integers, $a_0,a_1,….a_{n-1}$ and $l, 1<l<n$. Design a linear time algorithm to compute the maximum product subarray, whose length is atmost $l$.
asked Aug 27, 2019 in Algorithms Shaik Masthan 412 views
2 votes
1 answer
7
.Given an array of distinct integers A[1, 2,…n]. Find the tightest upper bound to check the existence of any index i for which A[i]=i. Ans should be O(log n) right by doing binary search ??
asked May 21, 2019 in Algorithms Hirak 317 views
0 votes
2 answers
8
i write this program, during initialization of array i given the size as 11 means the number of elements stored in an array is 11. as we know array is not assigned a value of index 12 and above. but in in the program array a is initialized of index from 0 to 19,my question is how the array is initialized with 20 ... ; for(i=0;i<20;i++) { a[i]=i+1; } for(i=0;i<20;i++) { printf("%d\n",a[i]); } }
asked Apr 7, 2019 in Programming shiva0 244 views
0 votes
0 answers
9
An OS uses virtual memory with paging technique for memory allocation. Which of the following searching technique on given data structure use locality of reference? Linear search on linked list Binary search on array Linear search on array Binary search on linked list
asked Mar 2, 2019 in Programming srestha 245 views
0 votes
1 answer
10
A Sorted array of n elements contains 0 and 1 to find out majority of 0 and 1.How much time it will take??? and please explain Meaning -majority of 0 and 1??
asked Feb 19, 2019 in DS sandeep singh gaur 193 views
1 vote
2 answers
11
Tell me the difference : &(arr+1) and &arr+1
asked Feb 17, 2019 in Programming Ahsanul Hoque 374 views
2 votes
0 answers
12
Q.Consider a 2 dimensional array A[40 ... 95, 40 ... 95] in lower triangular matrix representation. If the array is implemented in the memory in the form of row major order and base address of the array is 1000, then the address of A[66][50] will be ________.
asked Jan 27, 2019 in Programming Badayayash 218 views
0 votes
0 answers
13
asked Jan 22, 2019 in Algorithms bts1jimin 66 views
0 votes
0 answers
14
A two dimensional array is stored in column major form in memory if the elements are stored in the following sequence ... can be calculated as the column number of the element we are looking for summing with the $row \times column$ number of elements. How does the above recurrence relation work?
asked Jan 7, 2019 in DS kauray 167 views
2 votes
0 answers
15
someone please explain this: how does a+1 differs from &a+1 in above code? detailed explanation would be of great help as they incremented &a by 6 and NOT 1
asked Dec 22, 2018 in Programming Markzuck 423 views
0 votes
0 answers
16
what will be the three address code for x=A[i][j] Given A[M][N] and w is word size; t1=i*N; t2=t1+j; t3=t2*w; t4=base address of array A[M][N] t5=t4+t3; x=t5; My doubt here: Is there any need of t4 variable for storing the base address of arrary or we can directly do it as t4=A[t3]; x=t4;
asked Dec 22, 2018 in Compiler Design Shivam Kasat 110 views
0 votes
1 answer
17
Suppose we have an array with base address 2000. Each element of the array occupies 2 bytes. And we want to fetch the first 8 bits of the first element of the array. What will it return? More precisely I want to know what is stored in memory location 2000 to 2001 are stored in binary in the array? 400 401 402 403 404
asked Dec 19, 2018 in DS Sweta Shaw 202 views
0 votes
1 answer
18
if array declared size is larger than values initialised. Then what value rest memory elements have , 0 or garbage?
asked Dec 17, 2018 in Programming bunty choudhary 84 views
0 votes
0 answers
19
1 vote
2 answers
20
main(){ int S[6] = {126,256,512,1024,2048,4096}; int *x=(int *) (&S+1); printf (“%d”,x); } int is 4 bytes; array starts from 2000 . The answer is 2024 I am getting 2004. Please explain the concept. If possible provide a resource.
asked Dec 11, 2018 in Programming Shamim Ahmed 241 views
1 vote
1 answer
21
Given a 2D array A[40….95, 40...95] in lower triangular representation, size of each element is 1 Byte Array implemented in row major order, base address is 1000 Address of A[66][50] ?
asked Dec 11, 2018 in DS Shamim Ahmed 169 views
0 votes
0 answers
22
0 votes
0 answers
23
This question is in CLRS,if we have a max heap it is always in sorted order(descending) order.And by extension if we have min heap the array is sorted in ascending order.Is this true? I have a counter example for 100,50,20,1,3,10,5,this satisfied max- ... it as an array is it an heapified representation or not? If we heapify after deletion and store max deleted element then we get sorted array.
asked Nov 15, 2018 in DS sripo 539 views
0 votes
1 answer
24
Consider a 2 dimensional array A[40 ..... 95, 40 ..... 95] in lower triangular matrix representation. The size of each element in the array is 1 byte. If the array is implemented in the memory in the form of row major order and base address of the array is 1000, the address of A[66] [50] will be ________.
asked Nov 1, 2018 in DS Ankish Gupta 3 233 views
0 votes
2 answers
25
What does it mean when they say "An array A[1...n] consists of a permutation of numbers 1....n.".? Also I'd be grateful if you give some example.
asked Nov 1, 2018 in Numerical Ability Mizuki 165 views
0 votes
1 answer
26
A is a 2D-array with the range [-5....5,3......13] of elements.The starting location is 100. each element accupies 2 memeory cells. Calculate the location of A[0][8] using column major order and row major order.Does indexing matter??Why C follow $0$ indexing??
asked Oct 22, 2018 in Programming Lakshman Patel RJIT 319 views
0 votes
0 answers
27
Predict the value returned by the function MyFunc(). int MyX(int *E, unsigned int size) { int Y = 0; int Z; int i, j, k; for(i = 0; i< size; i++) Y = Y + E[i]; for(i=0; i < size; i++) for(j = i; j < size; j++) { Z = 0; for(k = i; k ... of arr $B)$ The maximum element in any sub-array of arr $C)$ Sum of the maximum element in all sub-arrays of array arr $D)$ Sum of all the elements in the array arr
asked Oct 22, 2018 in Programming Lakshman Patel RJIT 76 views
0 votes
0 answers
28
Let arr[] be an array containing n integers. The following algorithm computes the frequency of each element in arr and stores it in another array fre[]. for(i=0;i<n;i++) { count=1; for(j=i+1;j<n;j++) { if(c) { count++; fre[j]=0; } } if(fre[i]!=0) { fre[i]=count; } } Choose the correct expression for C $A) arr[i]<=arr[j]$ $B) arr[i]>=arr[j]$ $C) arr[i]!=arr[j]$ $D) arr[i]==arr[j]$
asked Oct 22, 2018 in Programming Lakshman Patel RJIT 94 views
0 votes
0 answers
29
What is the Output of following Array ? A. 8 10 B. 10 8 C. 10 2 D. 8 1 E. Garbage value
asked Oct 20, 2018 in Programming Na462 416 views
3 votes
2 answers
30
int arr[2][3][2]; print(arr[1]-arr[0],arr[1][0]-arr[0][0]) P.s :Sorry i can't able to paste the question but this is main Context.
asked Oct 20, 2018 in Programming Abhisek Tiwari 4 550 views
...