goglas.blogg.se

Worksheet 17 linked list introduction list stack ans
Worksheet 17 linked list introduction list stack ans




Stack: Last In First Out (LIFO)Stack Implemented using Array with top pointer Implementation?Using Single Link List with head pointer, demo: Question 3 (MovieDataAnalysis)Given two TopList containing movies, perform:IntersectionUnionDifferenceRemember that A-B is not the same as B-A!*Person As preference:Person Bs preference: Question 2 (MovieDataAnalysis)Given time period (yearA yearB)Get movies that are produced within that range.Methods1: Scan and select the appropriate movies2: Copy the list and delete movies that are out of rangeWhat if we use Doubly Linked List?Pro and Cons?*2008 2007 2007 2008 2006

worksheet 17 linked list introduction list stack ans

Question 1 (MovieDataAnalysis)Insert New Item (Movie ADT) to LinkedListEnsure that you check for duplicate data!* Student PresentationT3Koh Xianghua, NicholasN/ASean Lim Wei XinqT4Tan Miang Yeow (Done Last Week)N/AChua Kien Chuan ChrisT5N/AN/AN/AT6Kuganeswari D/O KuhanesanChow Jian AnnChow Jian Ann*This week marks the end of this bidding systemSome students have not participate at all! Good for Round Robin stuffsGeneric LinkedList (slide 61-66) for a bug-free, ready-to-use LL Done Last Week

worksheet 17 linked list introduction list stack ans

Linked List Variations:Linked List with Tail PointerCan visit the tail very fast Cannot delete the tail easily In lecture notes (Slide 48-53): TailedLinkedList (revisited in Queue data structure later)Bidirectional Linked ListTwo pointers: forward/backwardCan go backwards, Can delete tail! Extra pointer is overhead In lecture notes (Slide 54-58): DoublyLinkedListCircular Linked ListRemember Tail only, Head = Tail.NextCan visit all node from any node. Linked List: RevisionThe concept of ADT ListADT List using ArrayPro & cons Discussed in T02Q3 and today in Q1!ADT List using Linked ListBasic idea: Slide 17Linked List Node has 2 parts:Item/Value/Content See T03Sup1&2Pointers to immediate neighborsSingle Linked ListThe basic traversal: head to tailUsually: insert from head ( Stack)In your lecture notes: BasicLinkList (Slide 26-28), ExtendedLinkedList (Slide 29-36)Generic Java (Slide 37-46) for our custom Basic and Extended LinkedList






Worksheet 17 linked list introduction list stack ans