arpitsharma17
BAN USERpush(int data)
{
queue.push(data);
// arr is an ArrayList here
while(data> arr.get[arr.size()-1] && arr.size()!=0)
{
arr.remove[arr.size()-1];
}
//the removal above will become amortized O(1)
arr.add(data);
}
int pop()
{
int t=queue.pop();
if(t==arr.get(0))
{
arr.remove(0);
}
return t;
}
int max()
{
return arr.get(0);
}
Reppamulapaya2, Area Sales Manager at Alcatel Lucent
Jorie , a Customer services manager with more than 6 years' experience working is responsible for managing the relationships between an ...
Repdubinalinda4, Animator at Apache Design
Hello, I am a school librarian from Lewistown USA. I work in public or private schools at elementary, middle and ...
Repaliciaable183, Analyst at 247quickbookshelp
I am an agent contract clerk who is responsible for handling the recruitment process. I advertise the vacancies for agents ...
done using dynamic programming
- arpitsharma17 December 01, 2012