The Gateway to Computer Science Excellence
+3 votes
297 views

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)

in Programming by | 297 views
+4

1) If starting element is E then 4, 

If any other starting element then 3.

2) In 3d array, to perform CMO,

first you have to traverse 19 positions of outer level, => 19*30*40 

then perform CMO as usual on inner 2d array, => 29*30 + 19

Hence total answer is => 10 + 19*30*40 + 29*30 + 19

0
It'll be 5 right?

C

BEDG

EDGAF
0

It is min size right?

ABF

ECF

ECG

ED

it will be 3

how 4?

0
If starting is E then all its 4 neighbours will be enqueued in the Queue
0
IF starting symbol is G then also 4 enqueud in the Queue

1 Answer

0 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.
ago by
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
52,315 questions
60,427 answers
201,756 comments
95,235 users