In reply to Aashish Itani:
Firstly, the declaration of queue & associative array is not proper. I hope your question is in associative array in whichever index you have 1, in that particular index of queue you should have zeros.
module test;
int q[$] = {5,1,2,3,4,5};
int ind[int]={0:0,1:0,2:1,4:0,7:1,10:0};
int idx;
int idx1;
initial
begin
if(ind.first(idx))
if(ind[idx]==1)
q.insert(idx,0);
if(ind.last(idx1))
if(ind[idx1]==1)
q.insert(idx1,0);
while(idx!=idx1)
if(ind.next(idx))
if(ind[idx]==1)
q.insert(idx,0);
$display("%p,%p",q,ind);
end
endmodule
Thanks & Regards,
Shanthi V A