SLR 14
No description yet. This curated deck is ready for daily study.
Card preview (7)
Describe a Linked List
• A dynamic data structure • Each node consists of data and a pointer • Pointer points to next node
London => Oxford => Birmingham => Manchester(null) Describe how the tour is amended to become London => Oxford => Manchester => York
• Oxford pointer changed to bypass Birmingham and point to Manchester • A node is created holding data York • Manchester remains in original position and pointer changed to point to York node • York node points to null
A program stores records about its customers. Often an individual customer’s record needs to be accessed. This is done by searching using the Customer ID. Explain why a hash table is better suited than a linked list to store the customer records, particularly as the company acquires more customers
• LL requires every node to be checked • LL will take longer to search • Hash table enables direct access to the location of the record • Hash table will take the same time to search as more nodes are added
Describe one difference between a stack and a queue
A stack has one pointer whereas a queue has two pointers - one for the head and one for the tail
Describe one difference between an array and a list
The size of an array cannot be changes once it has been created whereas a list can (static vs dynamic)
State how a tuple is different to a list
A tuple cannot be changed at runtime
Describe how the second item in a linked list would be accessed using pointer values
• Go to first position indicated by start pointer • From first position read the next pointer value • Follow this pointer value and access the data item