35 views

Uploaded by Aileen Lukaz

- Time Complexity
- Rr210301 Data Structures Through c
- Adams - Hash Joins Oracle
- A Closer Look Into PHP Arrays_ What You Don’t See _ Sherif's Tech Blog
- Searching&Sorting
- Software Design and Development HSC Half Yearly Notes
- Ch13
- Smvdu 5th Sem Java Lab
- Amazon Interview experiences 2016-2017.pdf
- 09 Advanced Process Panel 60
- Data Structure and Algorithm Analysis
- Handout
- Ch 2 Arrays
- ztcam
- Unit 3
- CRPITV91Askitis
- 1-s2.0-S0304397513000133-main
- Interview
- Perl Hashes Part II
- csetech-242.pdf

You are on page 1of 2

is full) Insertion: add to the end -> O(1), when it requires doubling could be O(n) Take out the lowest rank (for each node is f) node: O(n) as its not sorted Removal by ID: O(n) Membership test: O(n), we have to go through all slots in the array

EXPANDABLE ARRAY SORTED BY F-VALUE Insertion: using binary search (O(log2(n))), we have the cost of binary search + O(n) in the worst case to move all the elements, so O(n) Take out the lowest rank (for each node is f) node: O(log(n)) as its sorted Removal by ID: O(n), because it is sorted by f value not by ID Membership test: O(n), we have to go through all slots in the array since it is sorted by f value

EXPANDABLE ARRAY SORTED BY ID Insertion: using binary search (O(log2(n))), we have the cost of binary search + O(n) in the worst case to move all the elements, so O(n) Take out the lowest rank (for each node is f) node: O(n) as its sorted by ID Removal by ID: O(log(n)) to find the element, because it is sorted by ID now, but to take advantage of that we need not to shift the array each time. The cost of compacting the array is O(n), so the smart idea is to do that when insertion is performed, because it wont affect the big O notation of insertion. Note that then binary search is O(C), where C is the capacity of the array => N for this case will be the capacity (worst case it will be 2n) Membership test: O(log(n)), because it is sorted by ID

SORTED SINGLE LINKED LIST, based on the ID Insertion: O(n), because we have to go through the list until insertion point found, and then create a node and adjust a couple of links Take out the lowest rank (for each node is f) node: O(n) as its sorted by ID so need to go through all the elements in the list Removal by ID: O(n), because we cannot perform binary search and have to go through the list Membership test: O(n), we have to go through the list until we find it or find an element with greater ID

SORTED SINGLE LINKED LIST, based on the f value Insertion: O(n), because we have to go through the list until insertion point found, and then create a node and adjust a couple of links Take out the lowest rank (for each node is f) node: O(1), as it is the first element Removal by ID: O(n), because it is sorted by f value not by ID Membership test: O(n), as we have to go through the list

HASH TABLE (an array of linked lists (buckets)). N nodes (waypoints in A*) and M buckets The hash value gives the index of the bucket the node will be put in. For integers modulus M. % works well supposing the distribution of hashed value is homogeneously distributed across the domain. The hash function should provide the best possible distribution of elements from the domain on elements of the co-domain. Anyway, once the bucket is found, we have a sorted link list where we put the node. Average size of the lists assuming uniform distribution is N/M. Computing the hash function is done in O(1). Once the bucket is found, finding the element in the list costs at worst O(N/M). M is chosen. At the extremes you have M = N, M = 1 (degenerated table -> (sorted) linked list). Trade-off of hash table is located in space. The larger the M value, the worst the performance of the lowest rank removal, which becomes O(N), but the others become O(1) => giant hashed array. Insertion: Find the bucket (O(1)), then insert in the list and resort in O(nlogn). So O(nlogn). More precisely is O(N/Mlog(N/M)). Actually it is simpler not to resort and go through the list and do it that way in O(N/M). Take out the lowest rank (for each node is f) node: if hashed on the ID and the linked lists are sorted on the f values, the cost becomes O(M). If sorted on the ID, the cost still is O(N), because all elements on each buckets must be examined. Hashing for f is not helpful, because that wont determine the lowest f value. So best solution is to hash for ID and sort buckets by f. Removal by ID: hash + O(N/M) to actually adjust links in the list. Membership test: hash (O(1)) + going through the list (O(N/M)), so O(N/M).

EXTREME OPTIMIZATION BUT DOUBLE THE SPACE: hashed array + array of node ids sorted by f valuebut then the update of that structure would be bad??? Djikstra (BFS) - slow, best-first

- Time ComplexityUploaded byapi-3814408
- Rr210301 Data Structures Through cUploaded bySRINIVASA RAO GANTA
- Adams - Hash Joins OracleUploaded byrockerabc123
- A Closer Look Into PHP Arrays_ What You Don’t See _ Sherif's Tech BlogUploaded byDiego Machado da Rosa
- Searching&SortingUploaded byUdaibhanSingh
- Software Design and Development HSC Half Yearly NotesUploaded byHotz Inator
- Ch13Uploaded byCarter Lyon
- Smvdu 5th Sem Java LabUploaded byGyanendra Giri
- Amazon Interview experiences 2016-2017.pdfUploaded byDaood
- 09 Advanced Process Panel 60Uploaded byLuis Felipe Martinez
- Data Structure and Algorithm AnalysisUploaded byAnbalagan Guru
- HandoutUploaded byPriyank Sharma
- Ch 2 ArraysUploaded bythe_summit
- ztcamUploaded byDevith Menon Thirumangalath
- Unit 3Uploaded byAman Roy
- CRPITV91AskitisUploaded byDeepa Moorjmalani
- 1-s2.0-S0304397513000133-mainUploaded byLong Đào Hải
- InterviewUploaded byLatha Palaniappan
- Perl Hashes Part IIUploaded byRed Fox
- csetech-242.pdfUploaded byanon_92005543
- Hash IndexUploaded bynagarajuvcc123
- Search ListUploaded byMahidhara Subrahmanya Sarma
- Similarity Sezrch via HashingUploaded byRohit Garg
- Chomsky Classification of GrammarsUploaded byPratikRoy
- Dataset& Unix,Oracle DocUploaded byDinesh Sanodiya
- DictionariesUploaded byArnold Aravind
- Model PapersUploaded byAnonymous BOreSF
- Index SheetUploaded byAashish Goyal
- EEE Syllbus 3 to 4th SemUploaded byGorishsharma
- exhibit 1 associative array translation exampleUploaded byapi-292430759

- HT 306PD (sm-AFN75354522)Uploaded byRoberd Mihailov
- ENGI 2110Uploaded byjooshize
- pr-bios-secure-boot-attacks-uncovered.pdfUploaded byElsa Cristina David
- Group Theory and the Rubik’s CubeUploaded bys v k
- Filizadeh_2008_InterfacingEMTP.pdfUploaded bykra_am
- Gravitational Potential Due to Rigid BodyUploaded byRizka
- Gas Laws Packet 2 ANSWERSUploaded byJoseph Turner
- Enriquez Physio Ex2-Act 6Uploaded byVergel Jigs Enriquez
- Machine Fault SimulatorUploaded byAnkuran Saha
- 54997729 WinCC Flexible Time Switch EnUploaded bySaid Boubker
- PSEUDOCODE.pptxUploaded byRaja Rosenani
- contagion02_dupuy.pdfUploaded byAlex
- Mil Std 449dUploaded byNguyen Ho Long
- ch16Uploaded byMega Lialita
- Dm 00027198Uploaded byThanhha Nguyen
- DNA Unit Review WorksheetUploaded byAndreaLibonik
- Simplex Method (2-Stage)Uploaded byNoor Asiah
- 1.LED with 8051Uploaded byhari
- Objective-C Chapter 1Uploaded byJohn Riselvato
- TransmissionUploaded byBhanu Teja
- informatics practices cbse xiUploaded byKailash Sharma
- % Yield LabUploaded byiDeA
- James Webb Space Telescope (JWST) PresentationUploaded byPaul Adamczyk
- SPUploaded byHema Kuppi
- Avramopoulos-2012-Architectural Innovation A Game-theoretic Approach-000.pdfUploaded bybobster124u
- Gates.transistorsUploaded byDonald Adrian Castillo
- Prem Chowdhry CVUploaded byPrem Chowdhry
- DTMF LOgic basics and circuitary ppt.Uploaded byPratik Rekha Pandya
- Ionic vs Covalent Bonds Lab ActivityUploaded byAhmad Harb
- The Forms OfUploaded byMagnus