# Topic_4.1_Lists - Topic 4.1 Linked List Data Structures 1...

This preview shows pages 1–14. Sign up to view the full content.

1 Topic 4.1 Linked List Data Structures

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2 Data Structures square6 One of the most important aspects of computer programming is the creation of new data types that are appropriate for a particular problem. E.g list, tree, etc. square6 Data Structures are constructs used to represent these new types.
3 Data Structures square6 A data structure is an aggregation of atomic and composite data types into a set with defined relationships. square6 We create data structure via combination of data types and fit them into a structure such that we can define its relating rules. square6 Data structures can be nested.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
4 Example of Data structure No association Position association among the elements A heterogeneous combination of data into a single structure with an identified key A homogeneous sequence of data or data types knows as elements Record (Structs) Array
5 Linked List Data Structures square6 A linked list is a sequence of data types where each elements has a unique successor 1 2 3 4 6 Head 0 (Prev) (Curr)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
6 Linked List Data Structures square6 Generalized Linked List square6 Doubly Linked List square6 Circular List Linked List can be used to implement other data structures: square6 FIFO Queue square6 Priority Queue square6 Stack Linked lists can be divided into a variety of categories:
7 square6 Every node has two components: data and a pointer to another node. square6 Nodes linked together via the pointers Node Data Node pointer Data Node pointer Data Node pointer struct node { void* data; node* next; } typedef node* nodePtr

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
8 General List square6 A generalised list has a variety of methods for storing and retrieving data items square6 Data can be inserted and deleted anywhere square6 There are no restrictions on the operations that can be used to process the list. square6 A generalised list can be either ordered list or random list
9 General List square6 In an ordered list. The data are arranged according to some key. square6 This key may be part of the data -- videos ordered by title square6 Or it may be constructed from the data square6 A simple (say, integer) key constructed from the data may be included as part of the data

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
10 General List square6 If the list is ordered by some key. Additions and removals can occur anywhere in the list square6 We need a search process to find where such additions or deletions will occur
11 General List square6 To implement a generalised linked list a variety of functions would be provided eg: square6 AddToHead(); RemoveFromHead(); square6 AddToTail(); RemoveFromTail(); square6 Insert (); IsEmpty(); NumItems(); square6 Remove (); etc.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
12 Linear List square6 A linear list can be implemented in an array square6 While arrays are easy to create and use, their fixed size makes them inefficient for storing data that needs to be continually inserted and deleted.
13 Linear List square6 By implementing a linear list with a linked list the container is able to expand and contract as data items are added and deleted.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern