from linked_list_InterQ import Node, linked_list

# -----Interview Questions Testing-----
## Q6 - palindrome_check
# Input: a b b a
# Output: True
myList_0 = linked_list()
myList_0.add('a')
myList_0.add('b')
myList_0.add('b')
myList_0.add('a')
myList_0.display()
myList_0.palindrome_check()
myList_0.display()
from linked_list_InterQ import Node, linked_list

# -----Interview Questions Testing-----
## Q5 - Sum_list
# reverse order
# Input: (7 -> 1 -> 6) + (5 -> 9 -> 2)
# Output: 2  -> 1  -> 9
print('Reverse order :List 1 + List 2')
List_1 = linked_list()
List_1.add(7)
List_1.add(1)
List_1.add(6)
List_1.display()
List_2 = linked_list()
List_2.add(5)
List_2.add(9)
List_2.add(2)
List_2.add(9)
List_2.display()
print('Reverse order result:')
myList_0 = linked_list.sum_lists(List_1, List_2)
myList_0.display()

# forward order
# Input: (6 -> 1 -> 7) + (2 -> 9 -> 5)
# Output: 9  -> 1  -> 2
print('Forward order :List 1 + List 2')
List_1 = linked_list()
List_1.add(6)
List_1.add(1)
List_1.add(7)
from linked_list_InterQ import Node, linked_list
#from linked_list import Node, linked_list # use get()

# -----Interview Questions Testing-----
## Q7 - Intersection
# List1: 1 -> 2 -> 3 -> 4 ->
# same part:              -> 9 -> 10 -> 11
# List2:           7 -> 8 ->
# the node is (9)
print('before intersection:')
myList_1 = linked_list()
myList_1.add(1)
myList_1.add(2)
myList_1.add(3)
myList_1.add(4)
myList_1.display()
myList_2 = linked_list()
myList_2.add(7)
myList_2.add(8)
myList_2.display()

## '''
myList_Intersection = linked_list()
myList_Intersection.add(9)
myList_Intersection.add(10)
myList_Intersection.add(11)
myList_Intersection.display()

myList_1_cur = myList_1.head
myList_2_cur = myList_2.head
myList_Intersection_cur = myList_Intersection.head