dcsimg
Results 1 to 3 of 3

Thread: Reorder List Problem (Interview Question)

  1. #1

    Thread Starter
    Registered User
    Join Date
    Oct 2018
    Posts
    1

    Reorder List Problem (Interview Question)

    Hi,

    Can someone help me to solve this question asked in microsoft interview from Interviewbit.

    Code:
    Given a singly linked list
    
        L: L0 → L1 → … → Ln-1 → Ln,
    reorder it to:
    
        L0 → Ln → L1 → Ln-1 → L2 → Ln-2 → …
    You must do this in-place without altering the nodes’ values.
    
    For example,
    Given {1,2,3,4}, reorder it to {1,4,2,3}.
    Any pointers will do help.

    Thanks.

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    100,586

    Re: Reorder List Problem (Interview Question)

    The CodeBank forums are for sharing working code snippets, not for asking questions. I have asked the mods to move this thread to the C# forum. Please don't create a duplicate thread in the meantime.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    100,586

    Re: Reorder List Problem (Interview Question)

    As for the question, have you made any attempt at all? Have you at least tried to develop an algorithm, even if not code to implement it?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width