hi .. I m writing for the first time..
here r some solutions ;;
1> singly list -- finding last but nth element..
a. maintain 2 pointers initialised at root.
b. forward first to nth element
c. now forward both till first reaches end..
d. now second is poinint at last but nth element
e. remove it.
2. array duplicaion removal
a. sort the array using standard method..complexity O(n log n)
b. remove same consecutives.. complexity O(n)
c. overall complexity .. o(n log n)
se-E u again
|