Q2. We have shown the linear list as being implemented as a linked list in dynamic memory, but it is possible to
implement it in an array. In this case, the array structure has two basic fields, the data and the next index location. The
next index field allows the array structure to take on the attributes of the linked list. A linked list array is shown in the
figure.
Note that there are actually two lists in the array. The data list starts at element 2 and progresses through 6 and 0 and
to the end of the data at element 9. The second list links all the empty or available elements together. It starts at element
4, progresses through 1, 3, 7, and 8, and ends at 5.
2
Write a program that implements a linked list using an array. Your program should be menu driven and prompt the
user to insert data, delete data, and print the contents of the list, or search the list for given piece of data.
To insert new data, you must delete an element from the available list and then insert it into the data list. Conversely,
when
you delete a node from the data list, you must insert it into the available list.
Attachments:
Answers
Answered by
0
Draw a labelled diagram with the necessary switches to connect a bulb, a fan and a plug socket in a room with the mains. In what arrangement will you connect them to the mains?
Answered by
6
All nodes in the left subtree of a node have values less than the node's value.
All nodes in the left subtree of a node have values less than the node's value.All nodes in the right subtree of a node have values greater than the node's value.
All nodes in the left subtree of a node have values less than the node's value.All nodes in the right subtree of a node have values greater than the node's value.Both left and right subtrees are also binary search trees.
Similar questions