trabalho_skiplistlist.py 809 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. from skiplistlist import SkiplistList
  2. import pprint
  3. import numpy
  4. skipll = SkiplistList([0,1,2,3])
  5. sentinela = skipll.sentinel
  6. print('skiplistlist')
  7. pprint.pprint(vars(skipll))
  8. print('*'*30)
  9. print('sentinela')
  10. pprint.pprint(vars(sentinela))
  11. node = sentinela.next[0]
  12. for i in range(skipll.n):
  13. print('*'*30)
  14. print('next')
  15. pprint.pprint(vars(node))
  16. node = node.next[0]
  17. new_list = skipll.truncar(1)
  18. node = sentinela.next[0]
  19. print('###'*20)
  20. print('ARRAY TRUNCADO')
  21. pprint.pprint(vars(skipll))
  22. for i in range(skipll.n):
  23. print('*'*30)
  24. print('next')
  25. pprint.pprint(vars(node))
  26. node = node.next[0]
  27. node = new_list.sentinel
  28. print('###'*20)
  29. print('RETORNO ARRAY TRUNCADO')
  30. pprint.pprint(vars(new_list))
  31. for i in range(new_list.n):
  32. print('*'*30)
  33. print('next')
  34. pprint.pprint(vars(node))
  35. node = node.next[0]