0% found this document useful (0 votes)
9 views3 pages

Sheet 03

The assignment focuses on comparing arrays and linked lists, highlighting their unique characteristics, advantages, and disadvantages. It includes practical programming tasks in Java to analyze time and space complexity for both data structures, along with submission guidelines and a grading scheme. Additionally, it emphasizes academic honesty and outlines consequences for plagiarism.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views3 pages

Sheet 03

The assignment focuses on comparing arrays and linked lists, highlighting their unique characteristics, advantages, and disadvantages. It includes practical programming tasks in Java to analyze time and space complexity for both data structures, along with submission guidelines and a grading scheme. Additionally, it emphasizes academic honesty and outlines consequences for plagiarism.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

EC2731 Data Structures and Algorithms In Class Assignment 3

Comparison of LinkedList and Array


Assignment Date March 26, 2025
Duration 1 hour 45 minutes (8.30AM-10.15AM)
Preparation Time 2 hours

Introduction to Assignment
Arrays and linked lists are two fundamental data structures in programming, each with unique
characteristics and applications. Understanding their advantages and disadvantages is crucial for
selecting the appropriate data structure for a given task. This laboratory exercise aims to deepen
our understanding of these differences and complement the theoretical knowledge acquired in
the classroom.

Key Characteristics of Arrays


The following characteristics are true for arrays:
• Memory Allocation: Arrays store elements in contiguous memory locations, with a fixed
size allocated at compile time. This means the memory cannot be dynamically adjusted
during runtime.

• Access Method: Arrays offer fast random access to elements via their indices, making
them ideal for applications requiring frequent indexed access.

• Operations: Insertion and deletion operations in arrays are slower due to the need to shift
all elements following the insertion or deletion point, which can be time-consuming for
large arrays.

• Memory Utilization: Arrays have inefficient memory utilization when not fully used, as
the entire memory block is allocated upfront.

Key Characteristics of Linked Lists


The following characteristics are true for linked lists:
• Memory Allocation: Linked lists store elements in non-contiguous memory locations,
with memory allocated dynamically at runtime. This allows the list to grow or shrink as
needed.

• Access Method: Linked lists are node-based, where each node contains data and a pointer
to the next node. This structure makes random access inefficient, requiring sequential
access to elements.

• Operations: Linked lists excel at insertion and deletion operations because only the af-
fected node and its neighbors need updating, reducing time complexity compared to arrays.

• Memory Utilization: Linked lists utilize memory effectively by allocating it only for the
nodes in use.

March 2025
Summary
In summary, arrays are best suited for scenarios requiring fast access and fixed-size data, while
linked lists are more appropriate for dynamic data sets with frequent insertions or deletions.

Covered Learning Outcomes


The assignment will cover two learning objectives: LO1, which involves analyzing the time and
space complexity of algorithms using asymptotic notation, including best-case, worst-case, and
average-case scenarios; and LO2, which requires explaining operations related to basic data
structures such as lists, queues, stacks, trees, heaps, hash tables, and graphs.

Investigation Steps
Part A: Array data structure analysis
1. Write a Java program to create a given array size of n elements. Store values 1, 2, . . . , n
in the array. Modify this base code to include the following:

a) Include a method printElement which can retrieve the n th element and print it to
the console.
b) Include code to calculate the time complexity of the printElement method.
c) Include breakpoints at appropriate places in the program to be used in the debug mode
of the IDE to compute memory usage of printElement via VisualVM software.

2. Find the time and space complexity for different values of the input size n and graph. Use
the graphs to identify the Big-O complexity for time and space.

Part B: Linked list data structure analysis


1. Write a Java program to create a linked list of n elements. Store values 1, 2, . . . , n as
data in the nodes. Modify this base code to include the following:

a) Include a method printElement which can retrieve the nth element and print it to
the console.
b) Include code to calculate the time complexity of the printElement method.
c) Include breakpoints at appropriate places in the program to be used in the debug mode
of the IDE to compute memory usage of printElement via VisualVM software.

2. Find the time and space complexity for different values of the input size n and graph. Use
the graphs to identify the Big-O complexity for time and space.

Part C: Comments and conclusions


Compare the results of Parts A and B. Comment on the Big-O complexities giving reasons.

2
Submission Guidelines
Use the IC03.docx template provided on CourseWEB for your submission. Copy and paste the
Excel diagrams and tables into the template, adjusting section sizes as needed. Only one sub-
mission per group is required. Before uploading, rename the file to IC03 ¡Group Number¿.docx
and convert it to PDF before uploading.

Grading Scheme
This assignment accounts for 5% of your final grade. Each subpart is worth 10 marks, distributed
across the following criteria: accuracy of the estimates, methodology, and the explanation
provided.

Recommended Post Laboratory Investigation for Extra Credit


Complete the following tasks to deepen your understanding. Assume there are two linked lists
of sizes 10 and 15. The last five data items in both lists are identical. Develop an algorithm
to find the position in the linked lists after which the data items become identical. Perform a
theoretical analysis to determine the time complexity of your algorithm and compare it with the
actual observed time complexity. Can you propose an alternative algorithm with a different time
complexity? Conduct a comparative analysis for this algorithm as well.
You may use the IC03A.docx file to submit your answers. Before uploading, rename the
file to IC03A ¡Group Number¿.docx. As usual, you can copy and paste your work into the
designated spaces in the document. Correct submissions will earn an additional 25% of the
grade. Submission is optional.

Plagiarism Policy and Academic Honesty Guidelines


Academic honesty is essential for student integrity and reflects the values of the institution.
While collaboration—such as discussing assignments and sharing references—is encouraged,
plagiarism occurs when someone else’s work is presented as one’s own without proper acknowl-
edgment.
Forms of Plagiarism Include: Copying text, code, or ideas without citation. Submitting work
done by others. Using AI-generated content without disclosure. Self-plagiarism (reusing one’s
past work without approval).
Consequences of Plagiarism: Offenses may result in penalties ranging from reduced grades
to academic probation or expulsion.
How to Avoid Plagiarism: Cite all sources properly. Paraphrase correctly instead of copying.
Use plagiarism detection tools when allowed. Acknowledge contributions in group work. Ask
instructors for clarification when needed. Maintaining academic honesty ensures a fair and
ethical learning environment.

You might also like