hello everybody!
i have a question that i want to reverse the queue in BigO(1) time and space without effecting its enqueue, dequeue ,print and other function.
thnx in advance 4 answering

>i have a question that i want to reverse the queue in BigO(1) time and space
That's not a question. A question would be "How do I reverse a queue in O(1) time and space?". Also note that your "question" lacks sufficient detail to be answered properly.

>thnx in advance 4 answering
"Thanks in advance" is somewhat rule. It presumes an obligation to answer your question where no such obligation exists.

I don't think thats possible. Obviously, you will have to iterate over all
the elements to reverse the order.

I think the best you can do is : O(log(n))

>I don't think thats possible.
Not only is it possible, it's trivial. But the implementation of the queue matters very much.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.