Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old September 11th, 2012, 09:52 PM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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?
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 09: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 09:46 AM
Solution for solution eureka BOOK: ASP.NET Website Programming Problem-Design-Solution 4 August 15th, 2004 11:07 AM



All times are GMT -4. The time now is 10:59 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.