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 3rd Edition
This is the forum to discuss the Wrox book Programming Interviews Exposed: Secrets to Landing Your Next Job, 3rd Edition by John Mongan, Noah Kindler, Eric Giguere; ISBN: 978-1-118-26136-1
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK Programming Interviews Exposed: Secrets to Landing Your Next Job 3rd Edition 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 March 16th, 2016, 12:45 PM
Registered User
Points: 18, Level: 1
Points: 18, Level: 1 Points: 18, Level: 1 Points: 18, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2016
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default List unflattening

There is this old thread in the forum dedicated to the second edition :

List Unflattening

This section of the book apparently is still exactly the same in the third edition. I believe this part should be overhauled in the next edition.

More specifically, I think

- it is worth discussing that there is no algorithm able to unflatten any lists, independently of how those lists were flattened. The unflattening algorithm is specific to the flattening algorithm (at least I believe so)

- at first, it's unclear which flattened list organisation the author attempts to unflatten...

- and finally, it is unclear why the author overlooked the easiest unflattening algorithm :

Code:
void unflatten(Node** head, Node** tail)
{
    if (!(*tail)) return;
    Node* track = *tail;
    while (track)
    {
        if (track->child)
        {
            *tail = track->child->prev;
            track->child->prev = NULL;
            (*tail)->next = NULL;
        }
        track = track->prev;
    }
}

Last edited by yamaryl; March 16th, 2016 at 12:49 PM.
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
List Unflattening MattCruikshank BOOK Programming Interviews Exposed: Secrets to Landing Your Next Job 2nd Ed ISBN: 978-0-470-12167-2 8 March 14th, 2016 12:45 PM
Dim list As New List(Of Testclass) dotnetDeveloper General .NET 1 January 6th, 2009 08:19 PM
Dim list As New List(Of Testclass) dotnetDeveloper Visual Basic 2008 Essentials 0 January 6th, 2009 04:04 PM
fill dropdown list with items when parent list isaac_cm Pro PHP 1 July 10th, 2006 06:41 AM
List tablesname from database & list databasename ittorget MySQL 3 September 10th, 2005 04:06 AM



All times are GMT -4. The time now is 12:32 AM.


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