Tell how to check whether a linked list is circular.

1 Answer

Answer :

Create two pointers, each set to the start of the list. Update each as follows:  
while (pointer1) {
pointer1 = pointer1->next;
pointer2 = pointer2->next; if (pointer2) pointer2=pointer2->next;
if (pointer1 == pointer2) {
print (\"circular\n\");
}

Related questions

Description : Linked Lists -- Can you tell me how to check whether a linked list is circular?

Last Answer : Create two pointers, and set both to the start of the list. Update each as follows: while (pointer1) { pointer1 = pointer1->next; pointer2 = pointer2->next; if (pointer2) pointer2=pointer2->next ... before pointer1, or the item before that. Either way, its either 1 or 2 jumps until they meet.

Description : Which of the following statement is true? i) Using singly linked lists and circular list, it is not possible to traverse the list backwards. ii) To find the predecessor, it is required to traverse the list from the first ... linked list. A) i-only B) ii-only C) Both i and ii D) None of both

Last Answer : C) Both i and ii

Description : Suppose you want to delete the name that occurs before “Vivek” in an alphabetical listing. Which of the following data structures shall be most efficient for this operation? (A) Circular linked list (B) Doubly linked list (C) Linked list (D) Dequeue

Last Answer :  (B) Doubly linked list 

Description : Which one is the incorrect statement with regard to the importance of pedigree analysis? (a) It confirms that DNA is the carrier of genetic information. (b) It helps to understand whether the trait in ... linked to one of the autosome. (d) It helps to trace the inheritance of a specific trait.

Last Answer : (a) It confirms that DNA is the carrier of genetic information.

Description : A test cross is carried out to (a) determine the genotype of a plant at F2 (b) predict whether two traits are linked (c) assess the number of alleles of a gene (d) determine whether two species or varieties will breed successfully.

Last Answer : (a) determine the genotype of a plant at F2

Description : A system wherein items are added from one and removed from the other end. a) Stack b) Queue c) Linked List d) Array

Last Answer : Answer: b Explanation: In a queue, the items are inserted from the rear end and deleted from the front end

Description : How do you write a function that can reverse a linked-list?

Last Answer : if(head==0) return; if(head->next==0) return; if(head->next==tail) { head->next = 0; tail->next = head; } else { node* pre = head; node* cur = head->next; node* curnext = cur->next; ... cur->next = pre; pre = cur; cur = curnext; curnext = curnext->next; } curnext->next = cur; } }

Description : How do you find out if a linked-list has an end? (i.e. the list is not a cycle)

Last Answer : You can find out by using 2 pointers. One of them goes 2 nodes each time. The second one goes at 1 nodes each time. If there is a cycle, the one that goes 2 nodes each time will eventually meet the one that goes slower. If that is the case, then you will know the linked list is a cycle.

Description : Write a shell script to accept a number from user check whether number is even or odd.

Last Answer : 2 8

Description : Has anybody ever heard of someone being informed over the phone that a bad check has been linked to them by their Social Security Number?

Last Answer : answer:Sounds like a phishing scam. I would forget about it. Edit: Apparently, the FCC takes reports of phishing calls: http://esupport.fcc.gov/complaints.htm

Description : Explain whether there is acceleration of a rotating object at a balanced speed in a circular motion ?

Last Answer : : In a circular path, there is no acceleration of the rotating object at a balanced speed The rate of change of unequal velocity is called acceleration. So if the velocity is balanced , there will be no acceleration Be it in a circular way or in a straight way.

Description : Are the amount of chemicals in the food you eat (or don't eat) an issue to you (for example the McDonald's McRib Sandwich ingredient list, articles linked here)?

Last Answer : No. And the photo is just what meat looks like when it's flash frozen. Any meat will look like that. The fact that it's been chopped and pressed into that shape isn't particularly appealing to ... we do it with hamburgers too. Past too. Wendy's presses their hamburger into squares or they used to.

Description : Is it possible to return an entire linked list object from a method in C++ without running the destructor?

Last Answer : Your description in the problem doesn't really describe what you want it to do that you would call right, nor does it explain how it uses its linked list. If you haven't figured out exactly what you want ... want to do that you can describe clearly, then yes, there will be a right way to do it.

Description : Which is/are correctly linked here? `{:(,"List I",,"List II"),((a),E_(1)Cb,(a),"Carbanion formation"),((b),E_(2),(b),"Stereo specific"),((c),S_(N^(1))

Last Answer : Which is/are correctly linked here? `{:(,"List I",,"List II"),((a),E_(1)Cb,(a),"Carbanion formation" ... "),((d),E_(1),(d),"Carbocation formation"):}`

Description : Define what is linked list?

Last Answer : A linked list is composed of nodes that are connected with another. In C programming, linked lists are created using pointers. Using linked lists is one efficient way of utilizing memory for storage.

Description : If the queue is implemented with a linked list, keeping track of a front pointer and a rear pointer, which of these pointers will change during an insertion into a non-empty queue? (A) Neither of ... (B) Only front pointer changes (C) Only rear pointer changes (D) Both of the pointers changes

Last Answer : (C) Only rear pointer changes

Description : Consider an implementation of unsorted single linked list. Suppose it has its representation with a head and a tail pointer (i.e. pointers to the first and last nodes of the linked list). Given the ... the front node of the linked list. (D) Deletion of the last node of the linked list.

Last Answer : (D) Deletion of the last node of the linked list. 

Description : Tell Me Do You Have Regular Visibility Into Excess And Obsolete Stock, And Is It Linked To Targeted Action Plans To Sell Off Or Reduce This Inventory?

Last Answer : Typically, excess and obsolete stock stems from ineffective sales forecasting, planning or using a business model that fails to factor in product complexity and life cycles correctly. Inventory leaders establish ... fear of the write-off has led to a large buildup over time of obsolete inventory.

Description : Check whether this sentence is grammatically correct or not- you are busy at your work from last few days?

Last Answer : answer:Not that im the best for this kind of thing, in fact ill probably have more spelling mistakes and grammatical errors in my answer than in your sentence. but you are should be are you . but you ... . Personally, i would say have you been busy at your place of work for the past few days .

Description : Check whether the following are quadratic equations: (i) (x+ 1)2=2(x-3) (ii) x - 2x = (- 2) (3-x) (iii) (x - 2) (x + 1) = (x - 1) (x + 3) (iv) (x - 3) (2x + 1) = x (x + 5) (v) (2x - 1) (x - 3) = (x ... vi) x2 + 3x + 1 = (x - 2)2 (vii) (x + 2)3 = 2x(x2 - 1) (viii) x3 -4x2 -x + 1 = (x-2)3 -Maths 10th

Last Answer : this is the correct answer!

Description : 3. Check whether 7+3x is a factor of 3x3+7x. -Maths 9th

Last Answer : Solution: 7+3x = 0 ⇒ 3x = −7 ⇒ x = -7/3 ∴Remainder: 3(-7/3)3+7(-7/3) = -(343/9)+(-49/3) = (-343-(49)3)/9 = (-343-147)/9 = -490/9 ≠ 0 ∴7+3x is not a factor of 3x3+7x

Description : Check whether p(x) is a multiple of g(x) or not -Maths 9th

Last Answer : p(x) is a multiple of g(x) or not

Description : Plot the following points and check whether they are collinear or not -Maths 9th

Last Answer : (i) Plotting the points P (1, 3), Q (-1, -1) and R (-2, - 3) on the graph paper and join these points, we get a straight line. Hence, these points are collinear. (ii) Plotting the points ... 6 (5, 5)on the graph paper and join these points, we get a straight line. Hence, given points are collinear.

Description : Check whether p(x) is a multiple of g(x) or not -Maths 9th

Last Answer : p(x) is a multiple of g(x) or not

Description : Plot the following points and check whether they are collinear or not -Maths 9th

Last Answer : (i) Plotting the points P (1, 3), Q (-1, -1) and R (-2, - 3) on the graph paper and join these points, we get a straight line. Hence, these points are collinear. (ii) Plotting the points ... 6 (5, 5)on the graph paper and join these points, we get a straight line. Hence, given points are collinear.

Description : Check whether polynomial p(x) = 2x(cube) - 9x(square) + x + 12 is a multiple of 2x-3 or not. -Maths 9th

Last Answer : Solution :-

Description : Check whether the point (a ,– a) lies on y=x–a or not. -Maths 9th

Last Answer : Solution :-

Description : Check whether the graph of the equation y = 3x + 5 passes through the origin or not. -Maths 9th

Last Answer : Solution :-

Description : Plot the following points and check whether they are collinear or not: -Maths 9th

Last Answer : Solution :-

Description : Check whether the relation R defined in the set {1, 2, 3, 4, 5, 6} as R = {(a, b): b = a + 1} is reflexive, symmetric or transitive. -Maths 9th

Last Answer : Reflexive: R = {(a, b) : b = a +1} = {(a, a + l) : a, a + 1∈{l, 2, 3, 4, 5, 6}} = {(1, 2), (2, 3), (3, 4), (4, 5), (5, 6)} ⇒ R is not reflexive since (a, a) ∉R for all a. Symmetric: R is not symmetric as (a ... as (a, b) ∈ R and (b, c) ∈ R but (a, c) ∉ R e.g., (1, 2) ∈ R (2, 3) ∈ R but (1, 3) ∉R

Description : How can I allow the customers to check whether the product is available to the desired location or not?

Last Answer : Many apps can help you engage with your audience by sending them to alert, s.m.s. and emails. The back in stock app by Appikon is beneficial and reliable for such tasks. You should try this app.

Description : square cross section b/h/h'=400/400/40mm with a reinforcement ratio of p=0.015 is loaded for action forces of axial load plus uniaxial bending.the column is to be made of C25/30 concrete & S-460 steel.check whether the column AB is short or long?

Last Answer : 10001/999900

Description : Is there any application which can help me to check whether my weight is normal for my age and height?

Last Answer : Lucky for you there are apps that can help you check your weight and even your progress if you're gaining or losing. Here's some of them: aktiBMI Monitor Your Weight Loseit Fat Secret Mi Fit Smart Scale Happy Scale

Description : How can we check whether someone's mobile number in USA is active or not?

Last Answer : There are many sites online that will tell you if a mobile number is active or not. Unfortunately, these sites are a hoax and they don't work at all. They can try and give you a rough idea of the ... to get, then you'll need to call the cell phone provider to see if this number is still available.

Description : An object is placed in front of a mirror. Arrange the following steps in sequential order to determine the nature of the mirror. (A) Check whether the

Last Answer : An object is placed in front of a mirror. Arrange the following steps in sequential order to determine the nature ... A. ACBD B. BDCA C. ACDB D. BADC

Description : What is a perception check? a) a cognitive bias that makes us listen only to information we already agree with b) a method teachers use to reward good listeners in the classroom c) ... that allows you to state your interpretation and ask your partner whether or not that interpretation is correct

Last Answer : d) a response that allows you to state your interpretation and ask your partner whether or not that interpretation is correct

Description : RIM is used to check whether, ______ a) The write operation is done or not b) The interrupt is Masked or not c) a & b

Last Answer : b) The interrupt is Masked or not

Description : Write a program using switch statement to check whether entered character is VOWEL or CONSONANT

Last Answer : #include<stdio.h> #include<conio.h> void main() { char ch; clrscr(); printf("Enter character:"); scanf("%c",&ch); switch(ch) { case 'a': ... break; default: printf("\n Entered character is CONSONANT"); } getch(); }

Description : Different components of the motherboard of a PC unit are linked together by sets of parallel electrical conducting lines. What are these lines called? A) Conductors B) Buses C) Connectors D) Consecutives

Last Answer : Answer : B

Description : State the advantages of circular waveguide and list its applications. 

Last Answer : Advantages:  The circular waveguide are easier to manufacture than rectangular waveguides and are easier to join. The TM01 modes are rotationally symmetrical and hence rotation of polarization can ... waveguides are also used with the cavity resonators to carry the input and output signals.

Description : Whether the parcel bags and packet bags of the set are to be included in the transit bag or to be sent loose will be shown in a) The due mail list of the set b) The advance work paper of the set c) The sorting list of the set d) None of these

Last Answer : a) The due mail list of the set

Description : Can anyone tell me whether I will lose all my contacts if I reset my phone?

Last Answer : answer:What kind of phone do you have? What is your default back up method? Meaningful pictures that were messaged to you, save to your phone (and then back up).

Description : How can you tell whether or not you will become famous because of your writing?

Last Answer : answer:What I've been told is to read Writer's Digest and other writer-marketing magazines, to subscribe to the magazines that print writing you like (Glimmer Train, Harper's, etc), to join writers groups in ... 's one of the key things a writer has to do-self-promote the hell out of their skills.

Description : Does anybody know of a program or service that'll tell you whether or not a given server (someone else's) has a virus?

Last Answer : there’s a link scanner plugin for most browsers at download.com. Web of Trust also has a good head on what’s going down in the alleys of cyberspace.

Description : Is There Any Way To Tell Whether a person is male or female just by their face without any cultural cues?

Last Answer : Yes. Jawlines, eyebrows, mouth shape and hairline.

Description : Can anyone tell me what exactly determines whether an element or compound is flammable or not?

Last Answer : i know electons play a role in this

Description : Is there a website that will tell me whether it is sunny or foggy at Ocean Beach in San Francisco?

Last Answer : answer:Yes! http://www.surfline.com/reports/report.cfm?id=4127

Description : If they dug up some person who was buried a couple of hundred years ago and could get a DNA sample, would it be possible to tell whether I am related to him or her?

Last Answer : answer:At most, they could tell you that you share a relation to the corps. DNA is pretty definitive. Whether or not the deceased is the same person as the headstone implicates is subject to more scrutiny than DNA results. but I’m no scientist.

Description : You and nine other individuals have been captured by super intelligent alien overlords. The aliens think humans look quite tasty, but their civilization forbids eating highly logical and cooperative beings. ... , each of you must guess the color of your hat starting with the perso -Riddles

Last Answer : Let's see how it would play out if the hats were distributed like this. The tallest captive sees three black hats in front of him, so he says 'black,' telling everyone else he sees an odd ... go. It looks like these aliens will have to go hungry, or find some less logical organisms to abduct.

Description : Three working women have different careers. If only one of statements 1, 2 and 3 are true, can you tell whether or not Mary is a nurse? 1. This statement is only true if statement 5 is false. 2. This ... 1 are true. 4. Mary is a nurse 5. Karen is an artist. 6. Sarah is a photographer. -Riddles

Last Answer : Mary is not a nurse. The way to solve this riddle, is to consider statements 4, 5, and 6 and create a chart of all possible true and false answers. Next, fill in the chart according to statements ... three are true. Thus, it is determined that: Statement 4 and 5 are false and statement 6 is true.