View Single Post
  #12 (permalink)  
Old June 28th, 2009, 04:48 AM
sridhar sridhar is offline
Registered User
 
Join Date: Jun 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by ashu_k View Post
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
Perfect...
Reply With Quote