Search algorithm for a sorted double linked list
Posted
by SalamiArmi
on Stack Overflow
See other posts from Stack Overflow
or by SalamiArmi
Published on 2010-03-16T04:49:18Z
Indexed on
2010/03/16
5:06 UTC
Read the original article
Hit count: 470
As a learning excercise, I've just had an attempt at implementing my own 'merge sort' algorithm. I did this on an std::list, which apparently already had the functions sort() and merge() built in. However, I'm planning on moving this over to a linked list of my own making, so the implementation is not particuarly important.
The problem lies with the fact that a std::list doesnt have facilities for accessing random nodes, only accessing the front/back and stepping through. I was originally planning on somehow performing a simple binary search through this list, and finding my answer in a few steps.
The fact that there are already built in functions in an std::list for performing these kinds of ordering leads me to believe that there is an equally easy way to access the list in the way I want.
Anyway, thanks for your help in advance!
© Stack Overflow or respective owner