CSC-113-Tutorial11 - : Write a method public [ ] List...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
KSU / CCIS / CS DEPARTMENT CSC-113, SPRING 2010 TUTORIAL 11 Linked-List Exercise-1 : Write a method public List intersection(List L1, List L2) that receives two linkedList L1 and L2, and returns the intersection between L1 and L2. Example: L1 = (2, 50, 60, 17, 23, 12, 7, 15, 10) L2 = (18, 10, 4, 23, 10, 5, 20, 17) The intersection between L1 and L2 is L3=(17, 23, 10) Exercise-2
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: : Write a method public [ ] List splitIntoTwoLists( ) that splits the current linkedList L into two sub-lists L1 and L2 . One for the first front half of L , and one for the back half of L . If the number of elements is odd, the extra element should go in the front list. Example: L = (2, 3, 5, 7, 11), After splitting we will have two list s: L1 = (2, 3, 5) and L1 = (7,11)...
View Full Document

This note was uploaded on 11/28/2011 for the course COMPUTER S 113 taught by Professor Dr.safwanqasem during the Spring '11 term at King Saud University.

Ask a homework question - tutors are online