recategorized by
898 views
3 votes
3 votes

The minimum size of queue required when performing BFS on above graph is ________.
(Size of queue is represented by maximum number of element at any time).

I am getting 3.

Consider 3 dimensional Array A[90] [30] [40] stored in linear array in column major order. If the base address starts at 10, The location of A [20] [20] [30] is ________. (Assume the first element is stored at A[1][1][1] and each element take 1 memory location)

recategorized by

1 Answer

1 votes
1 votes
The answer would be 4 if we start with E then element enqueued in the queue are { B, F,C,G} .

Note: In a BFS, the worst-case size of the queue is the maximum number of elements that are adjacent to any particular node. In the above case, maximum number of adjacent nodes to any particular node is 4.

Related questions

0 votes
0 votes
1 answer
4
Souvik33 asked Nov 2, 2022
840 views
Which data structure would be most appropriate to implement a collection of values with the following 3 characteristicsSingly link list with head and tail pointerDoubly l...