Can we remove an element in a single linked list without
traversing?
Lets suppose the link list is like this
1 2 3 4 5 6
We need to remove 4 from this list (without traversing from
beginning) and the final link list shud be 1 2 3 5 6
only thing we know is the pointer to element "4". How can
we remove "4" and link "3" to "5"?
Answers were Sorted based on User's Feedback
Answer / mpoleg
1) copy content of element 5 to element 4
2) link element 4(which already contains number 5) to
element 6
3) delete element 5
Is This Answer Correct ? | 10 Yes | 1 No |
Answer / santosh patil
just copy elements from 5th to 4th den 6th to 5th n so
on.....at last delete the last node r set it to null
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / codeg
it is not possible in Single AND double linked list without
traversing from first and not knowing addr of 4..
its possible in circular doubly linked list only........
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / pradeep
its possible only if it is a doubly linked list.
Is This Answer Correct ? | 3 Yes | 6 No |
Memory address of all elements in a linked list are not
continuous. So if we only know the memory address of the
element "4", we cannot know memory address of element "3"
and "5" without traversing. And we cannot remove it from the
linked list.
Is This Answer Correct ? | 1 Yes | 4 No |
What is the use of static functions?
What are c++ stream classes?
is throwing exception from a constructor not a good practice ?
How do I run c++?
What do you mean by public protected and private in c++?
What is optimization in c++? when using volatile.optimization is not possible..what does this mean?
what is data Abstraction
Can char be a number c++?
What's the hardest coding language?
Write a program to read the data and evaluate the results of the election. Print all output to the screen. Your output should specify: The total number of votes, the number of valid votes and the number of spoilt votes. The winner(s) of the election. Hint: An appropriate search should be used to determine the winner(s). The votes obtained by each candidate sorted in terms of the number of votes obtained. Hint: An appropriate sort should be used to sort the candidate(s). The Source code should be saved as VotingSystem. Project Input: Candidates’ Names and Numbers 2501 Victor Taylor 2502 Denise Duncan 2503 Kamal Ramdhan 2504 Michael Ali 2505 Anisa Sawh 2506 Carol Khan 2507 Gary Owen Votes 3 1 2 5 4 3 5 3 5 3 2 8 1 6 7 7 3 5 6 9 3 4 7 1 2 4 5 5 1 4 0 Project Output: Invalid vote: 8 Invalid vote: 9 Number of voters: 30 Number of valid votes: 28 Number of spoilt votes: 2 The winner(s): 2503 Kamal Ramdhan 2505 Anisa Sawh Candidate Score 2503 Kamal Ramdhan 6 2505 Anisa Sawh 6 2501 Victor Taylor 4 2504 Michael Ali 4 2502 Denise Duncan 3 2507 Gary Owen 3 2506 Carol Khan 2
What is the c++ code?
Explain linear search.