Find the middle node in the linked list??
(Note:Do not use for loop, count and count/2)
Answers were Sorted based on User's Feedback
Answer / kstarmind
Keep two pointers,
1. fast pointer moves two nodes at a time
2. slow pointer moves one node at a time
keep moving both the pointers, once the fast pointer reaches
the end node, your slow pointer would be at middle of the list.
| Is This Answer Correct ? | 47 Yes | 5 No |
Answer / kar..
move the front pointer and rear pointer at equal
intervel,these both pointe will meet at one node is middle...
| Is This Answer Correct ? | 2 Yes | 3 No |
U mean without any looping statements r just for loop?????
It can be done in a single traversal using Hare n turtle
method as said above using a for or while loop.....
Without using looping statements d list can't be traversed..
Plz make the question clear.....
| Is This Answer Correct ? | 3 Yes | 10 No |
the process of defining something in terms of itself is called (or) in C it is possible for the functions to call themselves. A function called a) nested function b) void function c) recursive function d) indifinite function
Do you know the use of 'auto' keyword?
Explain the differences between public, protected, private and internal.
What is the size of empty structure in c?
How to reverse a string using a recursive function, with swapping?
write a C code to reverse a string using a recursive function, without swapping or using an extra memory.
9 Answers Motorola, TCS, Wipro,
how to sort two array of characters and make a new array of characters.
Which of the Following will define a type NODE that is a node in a Linked list? A)struct node {NODE*next;int x;};type def struct node NODE; B)typedef struct NODE {struct NODE *next;int x;}; C)typedef struct NODE {NODE *next;int x;}; D)typedef struct {NODE *next;int x;}NODE;
What is default value of global variable in c?
What is switch in c?
Explain how can you check to see whether a symbol is defined?
Where does the name "C" come from, anyway?