Question: Data Structure Lab Lab Number: (7) Subject: Splitstack) Lab Objectives Using SplitStack) method and sort a linked stack Lab Exercise Write a SplitStack( ) Method
Data Structure Lab Lab Number: (7) Subject: Splitstack) Lab Objectives Using SplitStack) method and sort a linked stack Lab Exercise Write a SplitStack( ) Method that divides a sorted linked Stack S, which contains Objects of Character, into two linked List (L1 and L2) according to the key (keyltem), where L1 contains all the items of Stack whose keys are less than or equal to item's key (keyltem) and L2 Contains all the items of Stack whose keys are greater than to item's Key (keyitem). void Splitstack (LStack S, LList L1, LList L2, Character keyttem) Note: To compare two objects of Character, you can use the character method compareTo() as follows: Character el -new Character('a'): Character c2 = new Character('b'); int v-c.compareTo(cl): v will hold number c 0 ifcl c2 alphabetically v will hold number Oifcl - e2 alphabetically
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
