Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. IT & Infrastructure
  4. How can this circular linked list coding be implemented to be a linked list ?

How can this circular linked list coding be implemented to be a linked list ?

Scheduled Pinned Locked Moved IT & Infrastructure
data-structuresquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vaithan
    wrote on last edited by
    #1

    How can this circular linked list coding be implemented to be a linked list ? #include #include #include class Cell { int info; Cell *next; Cell (int i) { info =i; next=this; } Cell( int i, Cell * n) { info=i;next=n; } friend class List; }; class List { Cell *rear; public : void put (int); void push(int); int pop(); int empty() {return rear==rear->next;} List() {rear=new cell (0);} ~List() { while (!empty() ) pop (); } };

    J 1 Reply Last reply
    0
    • V vaithan

      How can this circular linked list coding be implemented to be a linked list ? #include #include #include class Cell { int info; Cell *next; Cell (int i) { info =i; next=this; } Cell( int i, Cell * n) { info=i;next=n; } friend class List; }; class List { Cell *rear; public : void put (int); void push(int); int pop(); int empty() {return rear==rear->next;} List() {rear=new cell (0);} ~List() { while (!empty() ) pop (); } };

      J Offline
      J Offline
      jkgh
      wrote on last edited by
      #2

      .. and how do you detect circular lists? Hash tables of pointer values is my best guess. Thanks. Al When a man goes on a date he wonders if he is going to get lucky. A woman already knows - Frederick Ryder

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups