Lect16_lMore_ists_doubly_dummynode

Lect16_lMore_ists_doubly_dummynode - ITI 1121. Introduction...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ITI 1121. Introduction to Computing II * Marcel Turcotte School of Information Technology and Engineering Version of March 15, 2010 Abstract Linked List (Part 2) Tail pointer Doubly linked list Dummy node * These lecture notes are meant to be looked at on a computer screen. Do not print them unless it is necessary. Motd David Cummings, a programmer who worked on the Mars Pathfinder project, has written an interesting editorial in the L.A. Times encouraging Toyota to drop claims of software infallibility in their recent acceleration problems. He argues that embedded systems developers must program more defensively, and that companies should stop relying on software for safety. Quoting: If Toyota has indeed tested its software as thoroughly as it says without finding any bugs, my response is simple: Keep trying. Find new ways to instrument the software, and come up with more creative tests. The odds are that there are still bugs in the code, which may or may not be related to unintended acceleration. Until these bugs are identified, how can you be certain they are not related to sudden acceleration? L.A. Times, 2010-03-11 Time efficiency Compare the time efficiency of the dynamic array ( ArrayList ) and linked list ( LinkedList ) implementations of the interface List (both allow to store an unlimited number of objects). Let say that execution time of a method is variable (slow) if the number of operations depends on the number of elements currently stored in the data structure, and constant (fast) otherwise. Time efficiency Can you predict an overall winner beforehand? ArrayList LinkedList void addFirst( E o ) slow fast void addLast( E o ) slow slow void add( E o, int pos ) slow slow E get( int pos ) fast slow void removeFirst() slow fast void removeLast() fast slow Based on the above table, when would you use an array? Applications that need a direct (random) access to the elements. Based on the above table, when would you use a singly-linked list? Applications that add or remove elements at the start of the list only. Which implementation is more memory efficient? Speeding up addLast for SinglyLinkedList There is a simple implementation technique that makes adding an element at the end of a list fast. The problem with the singly linked list implementation is that one needs to traverse the data structure to access the last element....
View Full Document

This note was uploaded on 01/06/2011 for the course ITI 1121 taught by Professor Samaan during the Spring '10 term at University of Ottawa.

Page1 / 47

Lect16_lMore_ists_doubly_dummynode - ITI 1121. Introduction...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online