Given a single Linked list with lakhs of nodes and length
unknown how do you optimally delete the nth element from the
list?
Answer Posted / vignesh1988i
first create the list of unknown length..... then get the position of the element to be deleted from the user.... the start travelling in the list.... if it encounters the position prescribed by the user ... get the addresses in the list and shift that to the previous node and free this node........
thank u
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
What is the code in while loop that returns the output of given code?
What are static variables in c?
main() { struct s1 { char *str; struct s1 *ptr; }; static struct s1 arr[] = { {"Hyderabad",arr+1}, {"Bangalore",arr+2}, {"Delhi",arr} }; struct s1 *p[3]; int i; < BR> for(i=0;i<=2;i++) p[i] = arr[i].ptr; printf("%s ",(*p)->str); printf("%s ",(++*p)->str); printf("%s ",((*p)++)->str); }
How can a program be made to print the line number where an error occurs?
What is uint8 in c?
Hello. How to write a C program to check and display president party like if i type in the console "biden" and hit enter the output shoud be : "biden is democrat" and if i type "trump" and hit enter the output shoud be: "trump is republican"
What are the advantages of the functions?
What does c mean in standard form?
What is the difference between class and object in c?
shorting algorithmS
how do you write a function that takes a variable number of arguments? What is the prototype of printf () function?
Why are some ANSI/ISO Standard library routines showing up as undefined, even though I've got an ANSI compiler?
Why void main is used in c?
What is the use of function in c?
What are the different types of pointers used in c language?