7 views

Uploaded by Maurice Abney

test

save

- GL Account Reconciliation
- aai rezumat.pdf
- MIT18_310F13_Ch6
- AOA Lec No 5
- GFG Flipkart Questions
- Cracking System Design Interview Like A Pro – A 10 Day
- Gate 2012 Mock Test - Question Paper-For My Blog
- MGS3100_Slides8b
- avs1
- aricent
- Write a C Program to Find the Maximum Depth or Height of a Tree
- PeopleSoft Tree Manager (Appendix B Configuring Tree Manager on the Web)
- Software Engineering Solved Mcqs
- XML Store
- Exam II Outline
- TournamentTrees.pdf
- 15122 Final Exam Sheet
- A Modified Recursive X-Y Cut Algorithm for Solving Block Ordering Problems
- Akpotsui1992-2
- Clementine Nodo de Reference
- Lect33
- CSE
- How to Create Linked List Using C_C++ - CodeProject
- Chapter 6 Complete
- American Computer Science League (ACSL) Rules and Handbook
- 10.1.1.160
- PeopleSoft Tree Manager (Creating Trees)
- Prp
- Basic Tutorial 4_2D Analysis of Stage Contructed Embankment
- How to create Linked list using C_C++ - CodeProject
- Daftar Isi
- Recolección de Firmas.docx
- Ejemplo 18 listbox.docx
- Doc6
- Reporte Neptuno
- T1. RMS
- Case 1 sTUDY.docx
- anexo_16_RMF2018_parte2_22012018.doc
- Caballo
- El conflicto en el área escolar.doc
- Alejandrino v. Quezon.pdf
- Numeración ANSI dispositivos.doc
- definisi sekala otot
- CUESTIONARIO
- Reivindicar a Calcidio.pdf
- TUGAS MAKALAH
- 135113
- 251889915-ELEKTROPNEUMATIK-A-B-A-B-TAOFIK-HIDAYAT-5202412052.docx
- Daftar Nama Lab Di Jateng 1
- Programa
- bab 2.docx
- Hi3516DV100.pdf
- msds-crude-oil.pdf
- Revista Avispero No IV
- asd5
- P100 3 ancheta.pdf
- INV198425268.pdf
- COPYING.RUNTIME-gcc-tdm.txt
- MATERI KETUBAN PECAH DINI.docx
- 2 Fiziologia Membranei Si a Unitatii Neuromotori-signed

You are on page 1of 2

Priority queues are just like ordinary queues in that it has elements pushed in and popped out. The difference about priority queues is the fact that the ele ments pushed into the queue has a "priority" where elements with a higher priori ty will be popped out first, no matter how they were pushed into the queue. 3. An unbalanced tree that stores 2^24 elements would have minimum tree height i f each parent node had two child nodes. Therefore the tree height would be 24. 4. The worst cast scenario would be for unbalanced binary trees to ultimately de volve into linked lists, where each parent has one child node. Therefore, the ma ximum tree height would be 2^24. 5. First create the tree with a class, class tree. This class will have the priv ate subclass, class node, which has it's own private members, node *right and no de *left. The public members of class tree would be node *root which is the top of the tree and tree(){root = NULL;}. In order to put the tree in order, I'd use the function inorder(node). An if statement where if node is not equal to null, then return inorder(node.left)->visit(node)->inorder(node.right). The function would call itself recursively until the tree runs out of nodes. 6. In order to remove a specific element, if it's a leaf, delete the leaf. If it has one child, promote the child to to become the parent and then delete the ne w child. If it has 2 children, call the node to be deleted, choose one of the ch ildren and replace the parent with one of the children. Delete the new child. 7. A binary tree has elements smaller than the parent node to the left and the e lements bigger than the parent node to the right. If the list's elements continu ously got bigger, it would devolve into a linked list because each child is bigg er than it's parent, leading to a tree that only goes right, aka a linked list. If you had to continuously insert elements larger OR smaller than it's parents, it's worst time complexity, O(n) would easily be attained. 8. The insertAt() function would insert an element at a specific node of a balan ced binary tree. removeAt() would delete an element at a specific node, making i t null. size() would count the number of nodes in the tree. &at would return a r eference the element in the specified node. 9. The time complexity for the find operation is O(n). Since you are looking for a single element, you must search through each possible location until the spec ific element is found. Which is why it behaves so slow. 10. Finding by value would be O(n) time complexity because the computer must sea rch starting at the beginning of the array until it finds the value which was sp ecified which leads to the slow time. 11. Since you know the specific address in the array to insert an element, it ha s the time complexity O(1). Not much work has to be done to look at a specific a ddress in an array, which is why it takes so little time. 12. Find() and Insert() have to do the same amount of work. That work being to g o down the tree looking for the node where the value is linked, therefore they c omplete the same number of comparisons, therefore, they take similar time. O(log n) 13. An unbalanced binary tree is essentially a linked list. When items are inser

ted sequentially, you are always inserting a number bigger than the last and wil l therefore make a linked list consisting of only right child nodes. This make t he time complexity O(n) for those 100,000 consecutive elements. As for the rando m elements, since they are random, there is an equal probability that the random node would be either larger or smaller than it's parent, consequently, creating a approximately balanced tree with O(log n) steps. 14. The time to insert 1 million random elements and find 1 million random eleme nts are so close because they must complete approximately the same amount of wor k. By the same logic as question 12, they must complete approximately the same n umber of comparisons. O(log n) 15. These times are so close because both are essentially balanced trees. Concre teAVLTree was already balanced, so adding random elements doesn't change it much . However, ConcreteBTree was unbalanced; that is until 1 million random elements were inserted into it which made it essentially a balanced tree. In the end the y are both balanced trees with 1 million random elements, so time for find() for either one will be very close to the other.

- GL Account ReconciliationUploaded bySrinivas Chowdary Botla
- aai rezumat.pdfUploaded byVilceanu Doru Wyl
- MIT18_310F13_Ch6Uploaded bybhar
- AOA Lec No 5Uploaded bytayyaba
- GFG Flipkart QuestionsUploaded byRajiv Poplai
- Cracking System Design Interview Like A Pro – A 10 DayUploaded bybrian
- Gate 2012 Mock Test - Question Paper-For My BlogUploaded bybrightstudent
- MGS3100_Slides8bUploaded byPranav Goswami
- avs1Uploaded bySuresh Kumar
- aricentUploaded byyogibabe
- Write a C Program to Find the Maximum Depth or Height of a TreeUploaded byAnonymous HXY4UF
- PeopleSoft Tree Manager (Appendix B Configuring Tree Manager on the Web)Uploaded byNaveen Kumar Naidu
- Software Engineering Solved McqsUploaded byshilpareddy888
- XML StoreUploaded byJorge Acosta Lizarraga
- Exam II OutlineUploaded byJonathan Szynal
- TournamentTrees.pdfUploaded byИРадојичић
- 15122 Final Exam SheetUploaded bybobtheblob94
- A Modified Recursive X-Y Cut Algorithm for Solving Block Ordering ProblemsUploaded byPhaisarn Sutheebanjard
- Akpotsui1992-2Uploaded byvthung
- Clementine Nodo de ReferenceUploaded bythe_papon
- Lect33Uploaded bybunty da
- CSEUploaded byBalajiraidu Kanchu
- How to Create Linked List Using C_C++ - CodeProjectUploaded byShiwam Isrie
- Chapter 6 CompleteUploaded byVasantha Kumari
- American Computer Science League (ACSL) Rules and HandbookUploaded bybellataco
- 10.1.1.160Uploaded byrabik1234
- PeopleSoft Tree Manager (Creating Trees)Uploaded byNaveen Kumar Naidu
- PrpUploaded byFacundo Nunes
- Basic Tutorial 4_2D Analysis of Stage Contructed EmbankmentUploaded byPiotr Zieliński
- How to create Linked list using C_C++ - CodeProjectUploaded byRobert Cross