Click here to Skip to main content
13,288,520 members (65,748 online)
Rate this:
Please Sign up or sign in to vote.
See more:
i want a proper code for this with the time complexity
Posted 16-Nov-12 2:20am
OriginalGriff 16-Nov-12 7:37am
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
Use the "Improve question" widget to edit your question and provide better information.

Plus, demanding code is a very good way to annoy people, and to get nothing at all...

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Toggle a flag that tells if the list is traversed head-to-tail or tail-to-head.
HeadToTail= !HeadToTail;

This is O(1).

Don't forget to modify the list traversal routine to take this flag into account.

No kidding, this IS an acceptable solution.
SafarTimura 20-Nov-12 10:50am
Yeah i agree no reversing is required for a doubly linked list.


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.171207.1 | Last Updated 16 Nov 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100