Representing the list may or may not matter for a specific algorithm, but what does a list has to do with a stack/queue?
printf 0
Newbie Poster
Recommended Answers
Jump to PostA list is one of the possible implementations, you could use, to implement a stack or a queue. Anotherone would be an array.
Jump to PostNot always - it depends on the implementation of the list. For example a linked list has the same overhead for inserting an element in any specified position (indeed, if the implementation only keeps a ref to the head node then you have to search sequentially to get the end …
All 8 Replies
ddanbe 2,724
Professional Procrastinator Featured Poster
JamesCherrill 4,733
Most Valuable Poster Team Colleague Featured Poster
printf 0
Newbie Poster
ddanbe 2,724
Professional Procrastinator Featured Poster
JamesCherrill 4,733
Most Valuable Poster Team Colleague Featured Poster
printf 0
Newbie Poster
vegaseat 1,735
DaniWeb's Hypocrite Team Colleague
JamesCherrill 4,733
Most Valuable Poster Team Colleague Featured Poster
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.