Consider The Following Algorithm To Insert An Element In A #482
Consider the following algorithm to insert an element in a triply linked list. </p> <pre><code class="language-text">insertelement(data) { create a node with given data. if the linked list is empty { _____________ _____________ } if the given node is less than the head { link the nodes through address and adjust the tail } if the given node is not less than the head { if the given node is equal to the head { new node is inserted on top of the head } else { traverse the linked list to find an element greater than the node and insert in front of the node } } }</code></pre> <p> Which of the following option is best suited to fill the blank?
This multiple choice question (MCQ) is related to the book/course gs gs121 Data Structures and Algorithms. It can also be found in gs gs121 Types of Lists - Triply Linked List - Quiz No.1.
Consider the following algorithm to insert an element in a triply linked list.
insertelement(data) { create a node with given data. if the linked list is empty { _____________ _____________ } if the given node is less than the head { link the nodes through address and adjust the tail } if the given node is not less than the head { if the given node is equal to the head { new node is inserted on top of the head } else { traverse the linked list to find an element greater than the node and insert in front of the node } } }
Which of the following option is best suited to fill the blank?
initializing previous, next and top pointers to null pointing the head and tail to the node created
pointing previous, next and top pointers to the node created initializing the head and tail to null
initializing previous, next and top pointers to null initializing the head and tail to null
pointing previous, next and top pointers to the node
Similar question(s) are as followings:
Online Quizzes of gs121 Data Structures and Algorithms
Binary Trees - Binary Search Tree - Quiz No.1
gs gs121 Data Structures and Algorithms
Online Quizzes
Binary Trees - Binary Search Tree - Quiz No.2
gs gs121 Data Structures and Algorithms
Online Quizzes
Binary Trees - Preorder Traversal - Quiz No.1
gs gs121 Data Structures and Algorithms
Online Quizzes