Visualizing Live Data Structures Curt Hill Department of














- Slides: 14
Visualizing Live Data Structures Curt Hill Department of Computer Systems and Software Engineering Valley City State University Curt. Hill@vcsu. edu Copyright © 2018 Curt Hill
This quote will be the only part of this presentation you remember. Copyright © 2018 Curt Hill
No! Seriously! • This project produces a 3 D visualization of any pointer based data structure – Must be part of a suitably enhanced C++ program • The visualization is static – Written to a file using the X 3 D format of XML • Many such files may be written as desired during a single run • Project had strange origins Copyright © 2018 Curt Hill
Algorithm Visualization • A long history of videos, Java applets and other specialized programs to show a particular algorithm does its work • The better ones generally allow the user to enter the value to be added, deleted or found • They are not live data in a student’s program • Debuggers are helpful but awkward Copyright © 2018 Curt Hill
• The Process The arbitrary program must include some extra classes – These produce the visualizations using X 3 D format • The data structure objects must be registered – Usually before anything is done to the dynamic data structure – Usually a method of the class • A snapshot of the current state may be taken at any time by calling the appropriate method Copyright © 2018 Curt Hill
Registration • The registration process requires the class to register any items to be displayed in the visualization • These include all the pointers as well as the data items that identity a particular object – The data items must be selected from a limited set of types and identified – What a pointer refers to must be identified Copyright © 2018 Curt Hill
Pointer Manipulation • The registration process uses the type of pointer manipulation for which C and C++ are justifiably maligned • Recall that the pointer is the GOTO of data structuring • Fortunately most of this manipulation is hidden from students Copyright © 2018 Curt Hill
Snapshot • Once the data objects have been registered the structure may be displayed • This requires calling the snapshot method with a pointer to the beginning of the data structure – This must include the registration type • The snapshot method examines the dynamic data structure and produces an X 3 D file – A recursive process Copyright © 2018 Curt Hill
Safety • VDS is subject to the same safety issues as printf/scanf • If the user lies as to the type of the data or pointers things can go wrong • However, there a couple of safeties installed Copyright © 2018 Curt Hill
Defused Problems • The VDS class keeps track of all containing pointers pursued – This prevents a cycle in the graph from causing an infinite loop • Prior to the start, the usable range of the heap is found – This prevents an invalid pointer from being used Copyright © 2018 Curt Hill
Layers • There are three layers to the typical program • The top layer is the arbitrary but enhanced program • The middle layer is the VDS class and support classes – Visual Data Structure • Bottom is X 3 D – Series of classes that produce the X 3 D file – These are independent of VDS Copyright © 2018 Curt Hill
Almost Finally • The project is a little farther along than when the paper was finalized – Thus demo pictures are different and hopefully better • However, it has not yet been tried on students Copyright © 2018 Curt Hill
Demo • I will do a short demo – This demo involves a three way tree – Binary tree with linked list for equal items – Two different object types and two different pointers – Key is string – Data is a float and integer • I can take questions now or later Copyright © 2018 Curt Hill
Structure Junk 1. 4 1 Crud 13. 1 2 Blah 7. 5 4 2. 8 5 41. 2 7 61. 2 8 Copyright © 2018 Curt Hill Stuff 21. 4 3 Trash 9. 3 9