View Single Post
  #6 (permalink)  
Old December 16th, 2004, 06:39 AM
ashu_k ashu_k is offline
Registered User
 
Join Date: Dec 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote