Skip to content

Conversation

@tuankhainguy
Copy link
Contributor

@tuankhainguy tuankhainguy commented Oct 20, 2024

PR for hashing algorithms implementation and some extra features.
Deployment can be accessed at Vercel

Screenshot 2024-10-20 at 22-15-02 Algorithms in Action

Screenshot 2024-10-20 at 22-15-43 Algorithms in Action

Screenshot 2024-10-20 at 22-16-11 Algorithms in Action

Screenshot 2024-10-20 at 22-16-49 Algorithms in Action

Features

Hashing

  • Insertion, Deletion and Search
  • Collision Handling
    • Linear Probing
    • Double Hashing
    • Chaining (prototype)
  • Hashing operations are properly visualised in array view and graph view formats
  • Added bulk insertion with the format start-end or start-end-step
  • Included the ability to toggle on and off dynamic table expansion before insertion
  • Added some helper functions in ParamHelper.js that help in input filtering and processing, all documented in the code

Extra features

setSize

  • The setSize function is in Tracer so it can be call by any visualiser
  • It sets the flex value of a visualiser box at any point
    // ratio of array : graph = 3 : 2
    vis.array.setSize(3)
    vis.graph.setSize(2)

setZoom

  • The setZoom function is in Tracer so it can be call by any visualiser
  • It can set the zoom of any visualiser at any point

Changes

Array2D

There are changes made to the Array2DTracer and Array2DRenderer to allow for vertical splitting and visualising

  • set takes additional parameter highlightRow to highlight a specific row
  • set takes additional parameter splitArray that contains mandatory property rowLength and optional property rowHeader to split an array
  • other functions are modified or added to work with arrays and split arrays
    • assignVariable, resetVariable
    • fill, unfill
    • updateValueAt, getValueAt
    • extractArray
  • Array2DRenderer changed to fit the larger size of hash table
  • Added some elements for Floating Boxes and made the use of them easy to be added into future algorithms

Ongoing

Chaining

  • The current chaining uses PopperJs library to show the chain on hover, all the table insert, delete and search animation are implemented. However, the actions made in the chains are yet to be visualized
  • For future development:
    • Stress test the whole chaining algorithm
    • Use the new linked list module to visualize the chains and actions such as search and delete
    • Maybe change the internal table into static array of linked lists as well, since currently it is a static array of dynamic arrays

Recommendation

  • Have a look through the documentation of PopperJS to know more
  • Currently the extractArray function in Array2DTracer can be used by any algorithms, but more Hashing-oriented, so minor modification before usage is recommended
  • If possible, making the setZoom smoother would be great

Testing Methodology

  • Tested on Vercel
  • Tested on Mac
  • Tested on Windows

Checklist

  • Have we followed conventional commits?
    • We have some conventional commits used but was not well implemented within the team
  • Have we followed the general coding ethics?
    • Yes, all our functions are well-documented and commented

nicked1205 and others added 30 commits August 13, 2024 15:24
Hashing tab created, added explanation and more
controller, parameters and index files are updated
* insertion for linear probing is now working

* hide large array overflow
subarrays overflow will be hidden
but can be seen by mouse drag
now variable will be scrolled into view
* added array extractor
a normal array can now be extracted from array tracer
* implemented highlights
added color higlights for pending, collision and insertion
…leaned up some visuals so just shows what is necessary.
@tuankhainguy tuankhainguy marked this pull request as ready for review October 20, 2024 12:47
@tuankhainguy
Copy link
Contributor Author

@Sraccity Ready for review

Copy link
Contributor

@lee-naish lee-naish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Praghash is otherwise engaged so I'm taking over merging etc (fingers crossed - I'm muddling through without necessarily knowing exactly what I'm doing:). Good work team!

@lee-naish lee-naish merged commit fe126fd into algorithms-in-action:2024_sem2 Jan 9, 2025
1 check passed
@lee-naish
Copy link
Contributor

That went pretty smoothly. Thanks again! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants