Guest User

Untitled

a guest
Apr 20th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. 1.
  2.  
  3. a:
  4. b: T
  5. c: F : an interface can be implemented in infinitely many ways
  6. d: F : a tree is an heirarchiel data structure
  7. e: F : it can be declared but not initialized
  8. f: F : reindexing an entire array takes more steps than generating one node of a LL
  9. g: F : that is not possible
  10. *h: F : a binary seach tree has a better time cost for search than a sorted array
  11. i: T
  12. j: T : an avl tree is a BST with the balance property, so an AVL rotation maintains the BST quality
  13. k: T
  14. l: T : if it is theta then it must also be O and omega
  15. m: F : this is a reference to the factory pattern
  16. n: F : what?
  17. o: T
  18. p: T
  19. q: F : abstract syntax trees are not limited to two children as a BST is
  20. r: T : heaps are typically implemented using arrays
  21. s: T
  22. t: T
  23. u: F : by n = 10 this is clearly false
  24. v: F : adt = abstract data type
  25. w: F : a leaf is a node without children
  26. *x: T
  27.  
  28. 2.
  29.  
  30. a: iterator
  31. b: queue
  32. c:
  33. d: doubly linked
  34. e: seperate chaining
  35. f: shallow
  36. g: precondition
  37. h: constant
  38. i: 3
  39. j: inorder
  40.  
  41. 3.
  42.  
  43. a: D
  44. b: E
  45. c: C
  46. d: C
  47. attempt to buld:
  48.  
  49. Y or <Start>X
  50. Z<Str>ZX or WZ
  51. Z<Start>XZ or ZYZX
  52.  
  53. e: A
  54. f: B
  55.  
  56. X: 1
  57. -- 0
  58.  
  59. cannot be a heap, heaps are "complete" binary trees
  60.  
  61. g: B
  62.  
  63. root = 0
  64. right child of root = 2(0) + 2 = 2
  65. left child of 2 = 2(2) + 1 = 5
  66. H: D
  67. I: D
  68. J: D
  69.  
  70.  
  71. 4.
  72.  
  73.  
  74. inserting 3:
  75.  
  76. 3
  77.  
  78. inserting 2:
  79.  
  80. 2
  81.  
  82. 3
  83.  
  84. inserting 1:
  85.  
  86. 1
  87. 3 2
  88.  
  89. inserting 4
  90.  
  91. 1
  92. 3 2
  93. 4
  94.  
  95. inorder traversal: 4 3 1 2
  96.  
  97. 5.
  98.  
  99. a. 4
  100. b. 4
  101. c. 3
  102. d. 2
  103. e. 3
  104. f. 4
  105. g. 7
  106. i. 4
  107. j. 4
  108.  
  109. 6.
  110.  
  111. selection sort: find biggest element, place into new array O(n^2)
  112. insertion sort: take index 0, find place in sorted array O(n^2)
  113. heap sort: ?????? O(nlog_2_n)
  114. merge sort: make n partitions, put stuff together log_2_n
  115. quicksort: dependent on pivot
  116.  
  117.  
  118. a. D
  119. b. C
  120. c.
Add Comment
Please, Sign In to add comment