Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > C++ Programming
|
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #11 (permalink)  
Old October 10th, 2007, 11:25 PM
Authorized User
 
Join Date: May 2007
Posts: 28
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to Peter_APIIT
Default

Traverse the list until end of the list and count backward until you find the correct position.

Linux is the best OS in the world.
Reply With Quote
  #12 (permalink)  
Old June 28th, 2009, 04:48 AM
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





Similar Threads
Thread Thread Starter Forum Replies Last Post
Challenging questions... rguru VS.NET 2002/2003 1 May 26th, 2004 04:40 AM
Challenging questions... rguru VB.NET 2002/2003 Basics 2 May 21st, 2004 01:40 PM
Challenging questions... rguru VBScript 0 May 16th, 2004 06:36 AM
Challenging questions... rguru Beginning VB 6 0 May 16th, 2004 06:35 AM
Challenging questions... rguru VB How-To 0 May 16th, 2004 06:35 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.