Home › Forums › IB Pseudo Code › Data Structures
- This topic has 9 replies, 6 voices, and was last updated 11 months, 3 weeks ago by
Irfan.
-
AuthorPosts
-
August 17, 2021 at 12:08 pm #6305
Eamonn
KeymasterYou have been taske with creating a board game, example chess, you have a choice of between 2 data strucre, array or linked list, explain which you would use and why. You answer should highlight the salient differences in the 2 data structures
August 18, 2021 at 10:14 am #6334girwan
ParticipantI choose an array because contents of an array can be accessed faster than linked list. Array elements are also independent of each other unlike linked list. They also require less memory per element as arrays don’t make use of nodes.
August 18, 2021 at 5:35 pm #6336joshua7
ParticipantI would choose an array. First of all, the array is independent allowing it to be accessed randomly. This means that it is also quicker to be accessed compared to a linked list. Reversing is also not possible in a linked list. Lastly there are less memory required in an array which makes it a good fit for creating a board game.
August 19, 2021 at 1:27 am #6340Eamonn
KeymasterMemory and access speed good.
Array elements are also independent of each other unlike linked list… what does this mean ?
Also we knwo at the begiining it will be a fixed size which is perfect for an array structure..
Can you redo answer pease
August 19, 2021 at 1:29 am #6341Eamonn
KeymasterI would choose an array.
First of all, the array is independent allowing it to be accessed randomly. access correct, but what do you mean by independent
This means that it is also quicker to be accessed compared to a linked list.
Reversing is also not possible in a linked list. What do you mean by reversing ?
Lastly there are less memory required in an array which makes it a good fit for creating a board game. good
August 19, 2021 at 2:00 am #6343Shiva Chandnani
ParticipantI would use an array to make my board game, or more specifically a two-dimensional array. I chose an array firstly because elements can be accessed faster compared to a linked list due to the reduced memory. Secondly, in an array, it is more difficult to add or remove elements, however, this is an advantage in this situation since board games as well have a fixed list of elements and don’t require changes.
August 19, 2021 at 2:50 am #6361Sang
ParticipantI would choose array as well because it uses less memory and also array allows random access
August 19, 2021 at 3:28 am #6362Eamonn
Keymastervery good,,, but think again about why elements can be accessed faster is it reduced memory or because they are contiguous ?
August 19, 2021 at 3:31 am #6363Eamonn
KeymasterGood Sang, please explain how it allows random // direct access (both the same)
August 19, 2021 at 5:37 pm #6402Irfan
ParticipantArray. Because an array is faster to access. And it won’t be confusing because of the changes made in a linked list would be cofnusing but in a array it would be easier to understand even after the changes.
-
AuthorPosts
- You must be logged in to reply to this topic.