Wrox Programmer Forums
|
BOOK Programming Interviews Exposed: Secrets to Landing Your Next Job 2nd Ed ISBN: 978-0-470-12167-2
This is the forum to discuss the Wrox book Programming Interviews Exposed: Secrets to Landing Your Next Job, 2nd Edition by John Mongan, Noah Suojanen, Eric Giguère; ISBN: 9780470121672
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK Programming Interviews Exposed: Secrets to Landing Your Next Job 2nd Ed ISBN: 978-0-470-12167-2 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
 
Old September 11th, 2012, 09:52 PM
Registered User
 
Join Date: Sep 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Question findMToLastElement solution *spoiler*

In the findMToLastElement solution, the book recommends using a lagging pointer approach as a more favorable alternative to traversing the list once to find its length and again to find the mToLast element.

I'm not clear on how this is faster (aside from possible locality advantages if the m variable is small enough but the authors seem concerned that it won't be) than scanning the list twice. Either way you are advancing through the list twice. In the second case, you are just doing both traversals at the same time instead of keeping track of how long the list is.

Any thoughts?





Similar Threads
Thread Thread Starter Forum Replies Last Post
Pages 43-44: findMToLastElement WayneHeym BOOK Programming Interviews Exposed: Secrets to Landing Your Next Job 2nd Ed ISBN: 978-0-470-12167-2 0 May 27th, 2011 02:16 PM
need solution nandhamca22 CSS Cascading Style Sheets 1 February 7th, 2006 10:16 AM
Solution! Aaron_j XSLT 1 July 30th, 2005 08:05 AM
what's the best solution for: eresina ASP.NET 1.0 and 1.1 Basics 2 November 16th, 2004 10:46 AM
Solution for solution eureka BOOK: ASP.NET Website Programming Problem-Design-Solution 4 August 15th, 2004 11:07 AM





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