Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Comparing arrays and linked list 3. (20%) You learned arrays (one dimensional, two dimensional etc.) and linked list (a) Explain what an array is briefly.

image text in transcribed

Comparing arrays and linked list 3. (20%) You learned arrays (one dimensional, two dimensional etc.) and linked list (a) Explain what an array is briefly. Explain what a linked list is briefly. (b) When is a linked list better than an array? When is an array better than a linked list? Explain! (for example, list 2 or more occasions that linked list is better or list 2 or more occasions when array is better. If you can list only one occasion, it is fine) (c) Find at least 3 operations for array, for example, searching? (or explain there are at most 2 operations) (d)Find at least 3 operations for linked list, for example insertion? (or explain there are at most 2 operations) Inserting an item in array and in linked list. 4. (30%) Suppose we have an array int a [8] = {1, 2, 3, 5, 6}; and we also have a linked list L of 5 entries 1 -> 2 -> 3 -> 5 -> 6, where 1 is the first in the linked list L, followed by 2 etc. We want to put a new item 4 between 3 and 5 in the array a and in the linked list L (a) Explain in plain English how you do that in the array a. You may have to shift items right (or left?) Do you use a loop like a for loop? You can write some C/C++/C# / Java code etc. to convince me, but do not have to run. (b)Explain in plain English hoe you do that in the linked list L. How do you change the link from 3 to 5 in the original list L? You can write some code or pseudo code to convince me

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DB2 Universal Database V7.1 Application Development Certification Guide

Authors: Steve Sanyal, David Martineau, Kevin Gashyna, Michael Kyprianou

1st Edition

0130913677, 978-0130913678

More Books

Students also viewed these Databases questions

Question

Which Department Century is the worst performing?

Answered: 1 week ago

Question

1.. Describe the key components of the Service Talent Cycle.

Answered: 1 week ago