Find the answer to your Linux question:
Results 1 to 2 of 2
how to reverse a linked list ?...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jun 2010
    Posts
    3

    reverse a linked list


    how to reverse a linked list ?

  2. #2
    Super Moderator Roxoff's Avatar
    Join Date
    Aug 2005
    Location
    Nottingham, England
    Posts
    3,915
    There are a number of ways; use stl, and have your linked list in a vector then use pop_back() to pull the end entries out and stuff them into some container the other way round.

    Or you could just use a doubly-linked list to start with then you just traverse it backwards.

    Or you could just type it backwards 'tsil deknil a'... perhaps that's what you want?

    This wouldn't be a homework question, would it? Because you know that they're not allowed.
    Linux user #126863 - see http://linuxcounter.net/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •