Post, Code and Quiet Time.
  • Home
Sign in Subscribe

Linked List

A collection of 2 posts
Depth First Search

Transform the binary search tree into a sorted two-way linked list

Question: Transform the binary search tree into a sorted two-way linked list. do not use recursion. do not create any new node, only adjust the pointer to point. 10 / \ 6 14 / \ / \ 4 8 12 16 -->> 4=6=8=10=12=14=16 struct BSTreeNode { int m_nValue; // value of
Oct 19, 2017 1 min read
Sort

Merge two sorted list

Question: Write a function in C++ to merge two already sorted linked lists, do not use recursion. Given a data structure: class Node { public: int data;                             Node* next; }; Implement the function: Node* Merge (Node* head1, Node* head2) { … } It takes in two already sorted linked lists (in ascendant order, duplicates allowed)
Oct 18, 2017 1 min read
Page 1 of 1
Post, Code and Quiet Time. © 2023
Powered by Ghost