Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Fundamentals of Dynamic Lists: Understanding Linked Lists, Slides of Data Structures and Algorithms

An introduction to dynamic lists and the concept of linked lists. It covers the basics of building a dynamic linked list, connecting nodes, and implementing a linked list in java. The document also includes exercises for practicing the concepts.

Typology: Slides

2012/2013

Uploaded on 04/23/2013

saratey
saratey 🇮🇳

4.3

(10)

87 documents

1 / 12

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Fundamentals of Dynamic Lists: Understanding Linked Lists and more Slides Data Structures and Algorithms in PDF only on Docsity!

Docsity.com

List Interface

A list can be defined as an ordered collection

In Java, several classes can be implemented usingList interface

ArrayList, LinkedList, Vector

Most programming languages provide constructsfor creating and managing lists

Array lists

Array’s are static lists

size is fixed at compile time

Can resize, but requires effort

Docsity.com

Linked Lists



Linked Lists can be built dynamically



Basic building of a dynamic linked list is a node



A linked list is a collection of nodes, each having a“reference” to the next node

Docsity.com

Connecting Nodes



A collection of nodes is a list



A collection of these nodes connected to each other iscalled a Linked List

Docsity.com

Head of the List



Head of the list is the “entry” point to the list



Head of a list is a reference to first node

7/2/

7

FFAAOO

data

??

data

head

Docsity.com

Linked List Nodes



A linked list node object can be generated from a class



Minimally a node contains two things

Data object

A reference

7/2/

8 Docsity.com

Code

// Class node

public class Node {

public Comparable data;public Node next;……

public class MyLinkedList

implements List {

Node head;……… ………

7/2/

10

Interface List

MyLinkedList

implements

Docsity.com

Cloning a List

7/2/

(^11) Docsity.com