[algogeeks] How will you implement a stack using a priority queue. Push and pop should be in O(1)

2013-05-25 Thread Nishant Pandey
I am not getting the y priority Q is getting used for this question, as in case of P Queue, things are arranged as per the priority so when we will insert the data we can simply increament the priority. Algo would be like this : Enque(q, data) { push(q, data, increrase the prioroty); } int

Re: [algogeeks] How will you implement a stack using a priority queue. Push and pop should be in O(1)

2013-05-25 Thread rohit jangid
you are doing it correct. On Sat, May 25, 2013 at 5:37 PM, Nishant Pandey nishant.bits.me...@gmail.com wrote: I am not getting the y priority Q is getting used for this question, as in case of P Queue, things are arranged as per the priority so when we will insert the data we can simply

[algogeeks] What data structures will you use to implement a text editor. Size of editor can be changed and you also need to save the styling information for all the text like italic, bold etc.EOM

2013-05-25 Thread Nishant Pandey
In one of the interview it was asked, can some one suggest good DS for this. Thanks -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from it, send an email to

Re: [algogeeks] How will you implement a stack using a priority queue. Push and pop should be in O(1)

2013-05-25 Thread Ankur Khurana
but in this approach , How is Push having O(1) complexity ? On 25 May 2013 17:52, rohit jangid rohit.nsi...@gmail.com wrote: you are doing it correct. On Sat, May 25, 2013 at 5:37 PM, Nishant Pandey nishant.bits.me...@gmail.com wrote: I am not getting the y priority Q is getting used