I have two queues Q1 and Q2 ;
Q1 :A1,A2, A3
Q2: B1, B2, B3
and i want to merge them to newQ:
like A1,B1,A2,B2 and so on...till the both Qs are empty
what is best Algorithm do you think?
I'm kind of confused i was thinking about a priority queue ????
graffil
0
Newbie Poster
Recommended Answers
Jump to Postfirst copy the nodes in each queu until either A or B are empty. After that copy the nodes in the remaining tree until it is empty. If the nodes of each queue are the same structure then you can just copy the address of the nodes from A and …
All 2 Replies
Reply to this topic
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.