473,378 Members | 1,605 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Difference between Circular Linked list and Loop in linked list

Hi

Can anyone explain me the difference between circular linked list and looped linked list?

1) In Circular linked list Next part of last node will be pointing to the first nodes starting address.

2) What is meant by loop then?

Thanks & Regards
Sathish Kumar
May 21 '08 #1
2 6412
weaknessforcats
9,208 Expert Mod 8TB
A circular linked list has the last element pointing to the first element. These are useful because you can use the prev pointer of the first element to access the last element immediately without having to traverse the entire list or by keeping an address somne where.

Circular linked lists are often used where the number of nodes is constant. Like logs. Your can create a log that holds the last 100 entries by using a circular linked list.

A loop in a linked list occurs when a node in the middle of the list points to another node in the middle of the list. Like A->B->C->D->B. When you traverse this list you get A->B->C->D->B->C->D->B->C etc... You can never get out of this loop. This is always an error.
May 21 '08 #2
gpraghuram
1,275 Expert 1GB
Hi

Can anyone explain me the difference between circular linked list and looped linked list?

1) In Circular linked list Next part of last node will be pointing to the first nodes starting address.

2) What is meant by loop then?

Thanks & Regards
Sathish Kumar
Circular linked list is the one in which you have control and the loop in a linked list is one which is caused by memory corruption or coding mistake which u dont have a control on it

Raghu
May 22 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: C++fan | last post by:
Suppose that I define the following class: class example_class{ public: example_class(); void funtion_1(); void function_2(); protected:
6
by: massimo | last post by:
Hey, I wrote this program which should take the numbers entered and sort them out. It doesnąt matter what order, if decreasing or increasing. I guess I'm confused in the sorting part. Anyone...
1
by: Booser | last post by:
// Merge sort using circular linked list // By Jason Hall <booser108@yahoo.com> #include <stdio.h> #include <stdlib.h> #include <time.h> #include <math.h> //#define debug
6
by: Steve Lambert | last post by:
Hi, I've knocked up a number of small routines to create and manipulate a linked list of any structure. If anyone could take a look at this code and give me their opinion and details of any...
5
by: Jani Yusef | last post by:
Based on an interview question I heard of but did not know the answer to....... How do you find and remove a loop from a singly linked list? In a google groups search I found the following code...
6
by: T Koster | last post by:
After a few years of programming C, I had come to believe that I finally knew how to correctly organise my structure definitions in header files for mutually dependent structures, but I find myself...
0
suzee_q00
by: suzee_q00 | last post by:
I will go ahead and give you a little background for what I am working on, though I have been hazy on pointers for some time. I get that a pointer points to an address in memory. Today I just...
6
by: Julia | last post by:
I am trying to sort a linked list using insertion sort. I have seen a lot of ways to get around this problem but no time-efficient and space-efficient solution. This is what I have so far: ...
12
by: shivapadma | last post by:
please anyone tell me whether the following code works for checking the linked list is circular or not? address 0 address1 address2 | A|address1| |B|address2| |C|address0|...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.