Question: This should not be language-specific, so basically pseudo-code or meta code. B) Write an algorithm to insert a new node in (ascending) lexicographic order in
This should not be language-specific, so basically pseudo-code or meta code. 
B) Write an algorithm to insert a new node in (ascending) lexicographic order in a singly linked circular list. Be sure you explicitly cover all four cases. Clearly indicate where you cover each of the 4 cases in your algorithm with an appropriate comment. Betty | Tom Zoro | F PT Ip - Sam Hint: Do the 4 cases 1 at a time. If (Pt= 22) I/List is empty. Ip.Link Pte Ip Else Il At least 1 item in the list. New first item in list? If(!p.Info Pt.Info) Distinkt PeteLink Pt.Link+ Ip Ptt lp Else //Has to be an interior node. P1 P2 Pt.link I/You finish using 2 pointers in lockstep. End If End If End If B) Write an algorithm to insert a new node in (ascending) lexicographic order in a singly linked circular list. Be sure you explicitly cover all four cases. Clearly indicate where you cover each of the 4 cases in your algorithm with an appropriate comment. Betty | Tom Zoro | F PT Ip - Sam Hint: Do the 4 cases 1 at a time. If (Pt= 22) I/List is empty. Ip.Link Pte Ip Else Il At least 1 item in the list. New first item in list? If(!p.Info Pt.Info) Distinkt PeteLink Pt.Link+ Ip Ptt lp Else //Has to be an interior node. P1 P2 Pt.link I/You finish using 2 pointers in lockstep. End If End If End If
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
