• Skip to primary navigation
  • Skip to content
  • Skip to primary sidebar
  • Skip to secondary sidebar

GoHired

Interview Questions asked in Google, Microsoft, Amazon

Join WeekEnd Online Batch from 4-April-2020 on How to Crack Coding Interview in Just 10 Weeks : Fees just 20,000 INR

  • Home
  • Best Java Books
  • Algorithm
  • Internship
  • Certificates
  • About Us
  • Contact Us
  • Privacy Policy
  • Array
  • Stack
  • Queue
  • LinkedList
  • DP
  • Strings
  • Tree
  • Mathametical
  • Puzzles
  • Graph

Reversal of LinkedList

February 20, 2014 by Dhaval Dave

Reversal of linked list simplified With Three Pointer Without Recursion

/* Link list node */
struct node
{
    int data;
    struct node* next;
};
 
/* Function to reverse the linked list */
static void reverse(struct node** head_ref)
{
    struct node* prev   = NULL;
    struct node* current = *head_ref;
    struct node* next;
    while (current != NULL)
    {
        next  = current->next;  
        current->next = prev;   
        prev = current;
        current = next;
    }
    *head_ref = prev;
} 
 
static void reverse(struct node** head_ref)
{
    struct node* prev   = NULL;
    struct node* current = *head_ref;
    struct node* next;
    while (current != NULL)
    {
        next  = current->next;  
        current->next = prev;   
        prev = current;
        current = next;
    }
    *head_ref = prev;
} 

 

Similar Articles

Filed Under: problem Tagged With: Linked List

Reader Interactions

Primary Sidebar

Join WeekEnd Online/Offline Batch from 4-April-2020 on How to Crack Coding Interview in Just 10 Weeks : Fees just 20,000 INR

Join WeekEnd Online/Offline Batch from 4-April-2020

WhatsApp us

Secondary Sidebar

Custom Search

  • How I cracked AMAZON
  • LeetCode
  • Adobe
  • Amazon
  • Facebook
  • Microsoft
  • Hacker Earth
  • CSE Interview

Top Rated Questions

Longest Increasing Subsequence

Find the number ABCD such that when multipled by 4 gives DCBA.

Given Set of words or A String find whether chain is possible from these words or not

Adobe Interview Questions 8 month Exp

Add Sub Multiply very large number stored as string

C Program for TAIL command of UNIX

Code Chef PRGIFT Solution

Generic Object Oriented Stack with Template

Print Power Set of a Set

Serialise Deserialise N-ary Tree

Find and print longest consecutive number sequence in a given sequence in O(n)

Check a String is SUBSEQUENCE of another String Find Minimum length for that ( DNA Matching )

Stock Buy Sell to Maximize Profit

In Given LinkedList Divide LL in N Sub parts and delete first K nodes of each part

Flipkart Set 1 On Campus with Answers

Daughter’s Age VeryGood Puzzle

Find if two rectangles overlap

There are N nuts and N bolts, u have to find all the pairs of nuts and bolts in minimum no. of iteration

Word Break Problem

Get K Max and Delete K Max in stream of incoming integers

Difference between a LinkedList and a Binary Search Tree BST

Sort Stack in place

Count Possible Decodings of a given Digit Sequence

K’th Largest Element in BST when modification to BST is not allowed

Diagonal Traversal of Binary Tree

Number of Islands BFS/DFS

Knight Tour Problem (Graph – Breadth First Search)

Python Array String

Edit Distance ( Dynamic Programming )

Inorder and Preorder traversals of a Binary Tree given. Output the Postorder traversal of it.

Copyright © 2026 · Genesis Framework · WordPress · Log in