In the puzzle shown, six round tiles (labelled 0, 1, 2, 3, 4, infinity) are move
ID: 3812076 • Letter: I
Question
In the puzzle shown, six round tiles (labelled 0, 1, 2, 3, 4, infinity) are moved around tracks. The group G, consisting of all legal moves, is generated by the two 4-cycles alpha = (0, 1, 4, 3) and beta = (1, 4, 2, infinity). Note that G is a subgroup of Sym(0, 1, 2, 3, 4, infinity), the group of all permutations of the six tiles, a group isomorphic to S_6 a. The 5-cycle around the outer track is gamma = (0, 1, infinity, 2, 3). Express gamma as a combination of the generators alpha and beta i.e. a product of powers of the two generators. This shows that gamma elementof G. b. Determine the order of G. c. How many elements of each order does G have? d. How many elements of G are even permutations, and how many are odd permutations? e. The group G is isomorphic to a group studied previously this semester. Based on your answers to (b) and (c) above, conjecture which group this is. f Name another group studied previously this semester, having the same order as G, but which is not isomorphic to G. The information in (c) can be used to justify why these two groups are in fact not isomorphic. You many use Maple or other comparable software in answering this problem. Before starting, you will probably want to rename the tiles 1, 2, 3, 4, 5, 6 to be acceptable for input to Maple. To answer (c) and (d), it is helpful first to list all elements of G, use the Maple command Elements (G);Explanation / Answer
def is_bintree(T):
if type(T) isn't tuple:
come back False
if T == ():
come back True
if len(T) != 3:
come back False
if is_bintree(T[1]) and is_bintree(T[2]):
come back True
come back False
def bst_min(T):
if T == ():
come back None
if not T[1]:
come back T[0]
come back bst_min(T[1])
def bst_max(T):
if T == ():
come back None
if not T[2]:
come back T[0]
come back bst_max(T[2])
def is_bst(T):
if not is_bintree(T):
come back False
if T == ():
come back True
if not is_bst(T[1]) or not is_bst(T[2]):
come back False
if T[1] == () and T[2] == ():
come back True
if T[2] == ():
come back bst_max(T[1]) < T[0]
if T[1] == ():
come back T[0] < bst_min(T[2])
come back bst_max(T[1]) < T[0] < bst_min(T[2])
def bst_search(T,x):
if T == ():
return T
if T[0] == x:
return T
if x < T[0]:
come back bst_search(T[1],x)
come back bst_search(T[2],x)
def bst_insert(T,x):
if T == ():
return (x,(),())
elif x < T[0]:
come back (T[0],bst_insert(T[1],x),T[2])
else:
come back (T[0],T[1],bst_insert(T[2],x))
def delete_min(T):
if T == ():
return T
if not T[1]:
come back T[2]
else:
come back (T[0],delete_min(T[1]),T[2])
def bst_delete(T,x):
assert T, "deleting price not in tree"
if x < T[0]:
come back (T[0],bst_delete(T[1],x),T[2])
elif x > T[0]:
come back (T[0],T[1],bst_delete(T[2],x))
else:
# T[0] == x
if not T[1]:
come back T[2]
elif not T[2]:
come back T[1]
else:
come back (bst_min(T[2]),T[1],delete_min(T[2]))
def print_bintree(T,indent=0):
if not T:
print('*')
return
else:
print(T[0])
print(' '*(indent + len(T[0])-1)+'---', end = '')
print_bintree(T[1],indent+3)
print(' '*(indent + len(T[0])-1)+'---', end = '')
print_bintree(T[2],indent+3)
def print_func_space(x):
print(x,end=' ')
def inorder(T,f):
if not is_bst(T):
return
if not T:
return
inorder(T[1],f)
f(T[0])
inorder(T[2],f)
# Programming project: offer implementations for the functions below,
# i.e., replace all the pass statements within the functions below.
# Then add tests for these functions within the block # that starts "if __name__ == '__main__':"
def preorder(T,f):
pass
def postorder(T,f):
pass
def tree_height(T):
# Empty tree has height -1
pass
def balance(T):
# returns the peak of the left subtree of T
# # minus the peak of the proper subtree of T
# i.e., the balance of the foundation of T
pass
def minBalance(T):
# returns the minimum price of balance(S) for all subtrees S of T
pass
def maxBalance(T):
# returns the most price of balance(S) for all subtrees S of T
pass
def is_avl(T):
# Returns True if T is associate AVL tree, False otherwise
# # Hint: use minBalance(T) and maxBalance(T)
pass
# Add tests for the on top of seven functions below
if __name__ == '__main__':
K = ()
for x in ['Joe','Bob', 'Phil', 'Paul', 'Marc', 'Jean', 'Jerry', 'Alice', 'Anne']:
K = bst_insert(K,x)
print(' Tree components in sorted order ')
inorder(K,print_func_space)
print()
print(' Print full tree ')
print_bintree(K)
print(" Delete Bob and print tree ")
K = bst_delete(K,'Bob')
print_bintree(K)
print()
print(" Print subtree at 'Phil' ")
print_bintree(bst_search(K,'Phil'))
print()
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.