How to implement a queue using one integer. this should store value 0 to 9. example suppose queue has first value 2 then insert 4 then 6 so it should look like 246. first value should be popped as 2. then it should be 46. program should support 0 in all the levels also. example queue should handle like 01235 also, 0 as first value in queue. remember 0 just to use integer, nothing else as data storage.
Click for Solution

  • Warning: Illegal string offset 'name' in /home/prepdo6/gpl4you/discussquessub.php on line 681
    A in the given solution the pop would need a right bit shift operation as
    01000101 &11110000 will not give 4 but 0100 0000
    that need to be shifted to get 4


  • Warning: Illegal string offset 'name' in /home/prepdo6/gpl4you/discussquessub.php on line 664

  • Warning: Illegal string offset 'name' in /home/prepdo6/gpl4you/discussquessub.php on line 682
    S use while loop method...make functions for pop and push as usual...
    for push: multiply existing queue by 10 and add the no. to be pushed...
    for pop: store queue in temp->reverse temp ->extract last digit->divide temp by 10->queue=temp;

[Insert Code]