Here is the pseudo-code for the push function:
K = queue actual size of the queue
N = max queue size
for i = K ; i < N ; i++
q.top(None)
for i = 0 ; i < K - 1 ; i++
q.bottom (q.bottom())
return q.bottom()
This blog provides questions commonly asked at technical interviews for software engineering roles. Solutions are given for most questions. Questions come from different sources but answers are my own.
K = queue actual size of the queue
N = max queue size
for i = K ; i < N ; i++
q.top(None)
for i = 0 ; i < K - 1 ; i++
q.bottom (q.bottom())
return q.bottom()
Aucun commentaire:
Enregistrer un commentaire