Skip to main content

Posts

Showing posts from April, 2021

Partitioning a linked list around a value X.

 /******************************************************************************                               Online C++ Compiler.                Code, Compile, Run and Debug C++ program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ #include <iostream> using namespace std; struct LinkedlistNode{     LinkedlistNode *next;     int val; }; int main() {     LinkedlistNode *n1 = new LinkedlistNode();     n1->val = 3;     LinkedlistNode *n2 = new LinkedlistNode();     n2->val = 5;     n1->next = n2;     LinkedlistNode *n3...