Question

In: Computer Science

Limit your answers to one paragraph or less. 1. Explain the difference between a statically allocated...

Limit your answers to one paragraph or less.

1. Explain the difference between a statically allocated array, a dynamically allocated array, and a linked list.

2. Linked lists have terrible performance for random access or searching of internal entries. Why?

3. Explain the advantages of adding a tail pointer to a linked list, and of doubly-linked over singlylinked lists.

Solutions

Expert Solution

1)

The main difference between a dynamic array and a regular array is the size. In a regular array the sized is fixed from compilation. In closing the size of an array you can't change it again just think of it set in stone. A dynamic array is basically an array that grow and shrink on demand during run time. An extendable array is a prime example of a dynamic array.the arrays offers constant time access of the elements no matter weather it is static or dynamic array.

on the other hand linked list of a data structure which provide sequential access of the elements. One of the disadvantages of arrays is that memory could be wasted but linked list take only that much memory which is required to store the elements. in arrays the insertion in between the other elements in always slow but in linkedlist the insertion is always efficient

2)

linked list data is a data structure made of nodes where each node in the list is connected with other node by pointers so it have a start and end . the nodes in the list is not indexed so we can not access the list by random access so we have to traverse always from the start .hence the performance will be less as compare to array

3)

advantage of tail pointer is inserting at the end is O(1) instead of O(N).advantage of doubly linked list is we can move both forward and backward in the list and the delete operation in DLL is more efficient if pointer to the node to be deleted is given.


Related Solutions

Writing a statically allocated linked list in ARM assembly (raspberry pi). Step 1: You will statically...
Writing a statically allocated linked list in ARM assembly (raspberry pi). Step 1: You will statically allocate some space for your link list elements. You need to make 5 elements, each elements should have two components, the next pointer first then the value stored. First initialize next pointer to NULL. The value stored at the address will be a string pointer. Step 2: You will then write a function that links the statically allocated linked list elements together. Step 3:...
Explain the difference between under allocated overhead and over allocated overhead. What causes each situation?
Explain the difference between under allocated overhead and over allocated overhead. What causes each situation?
In one paragraph explain the difference between redneck racism and polite racism, and explain why focusing...
In one paragraph explain the difference between redneck racism and polite racism, and explain why focusing on redneck racism is problematic.
Would the following function work correctly if statically allocated activation records are used for implementation? Explain...
Would the following function work correctly if statically allocated activation records are used for implementation? Explain why it would work or not.                    fun fact x = if x <= 0 then 1 else x * fact(x - 1);
Discuss the difference between direct costs and allocated costs and why allocated costs are important to...
Discuss the difference between direct costs and allocated costs and why allocated costs are important to include in project costs. Further, and regarding allocated costs, disucss how an organization determines costs to be allocated and the basis of the allocation methodology (i.e. choice of the cost allocation base).
Use the Central Limit Theorem to explain the difference between the sampling distribution of x and...
Use the Central Limit Theorem to explain the difference between the sampling distribution of x and x-bar.
What is the difference between a single limit and a split limit in expressing liability limits...
What is the difference between a single limit and a split limit in expressing liability limits in the PAP? Explain how the Securities and Exchange Commission attempts to prevent violations of SEC regulations.
Explain the difference between a limit order and a market order. What type of order provides...
Explain the difference between a limit order and a market order. What type of order provides immediacy? With respect to a real-world case, explain whether financial intermediaries may play any role in a market with an electronic order book.
What is the difference between Leadership and Management? One paragraph essay answer would be nice.
What is the difference between Leadership and Management? One paragraph essay answer would be nice.
All answers must be in your own words In a short paragraph each, explain the importance...
All answers must be in your own words In a short paragraph each, explain the importance of each of the following men in the history and development of modern corrections. Jeremy Bentham, John Howard, Cesare Beccaria and William Penn.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT