GfG QA is closing soon... Please refer PRACTICE or GfG now on wards !!

Find the median of simple linked list and add a node to list

1) Find the median of linked list and write all corner cases too.(without counting the nodes in integer)
2) After that interviewer added that please add a node near to median/ place of median but linked list's median must remain at median of whole linked list.
3) Write the all corner cases for the same

asked Dec 29, 2015 by Milan Ardeshana

"add a node near to median/ place of median" - I did not get this part. Can you please add an example explaining the same.

1 Answer

Write a method addnode which will afd a node at before / after the median, but it should not change the median.
answered Feb 13, 2016 by anonymous