6 kyu

Linked Lists - Sorted Intersect

218 of 540JDeBolt

Description:

Linked Lists - Sorted Intersect

Write a SortedIntersect() function which creates and returns a list representing the intersection of two lists that are sorted in increasing order. Ideally, each list should only be traversed once. The resulting list should not contain duplicates.

var first = 1 -> 2 -> 2 -> 3 -> 3 -> 6 -> null
var second = 1 -> 3 -> 4 -> 5 -> -> 6 -> null
sortedIntersect(first, second) === 1 -> 3 -> 6 -> null

Related Kata in order of expected completion (increasing difficulty):
 Linked Lists - Push & BuildOneTwoThree
 Linked Lists - Length & Count
 Linked Lists - Get Nth Node
Linked Lists - Insert Nth Node
Linked Lists - Sorted Insert
Linked Lists - Insert Sort
Linked Lists - Append
Linked Lists - Remove Duplicates
Linked Lists - Move Node
Linked Lists - Move Node In-place
Linked Lists - Alternating Split
Linked Lists - Front Back Split
Linked Lists - Shuffle Merge
Linked Lists - Sorted Merge
Linked Lists - Merge Sort
Linked Lists - Sorted Intersect
Linked Lists - Iterative Reverse
Linked Lists - Recursive Reverse

Inspired by Stanford Professor Nick Parlante's excellent Linked List teachings.

Linked Lists
Data Structures
Algorithms

Stats:

CreatedSep 2, 2015
PublishedSep 2, 2015
Warriors Trained1119
Total Skips150
Total Code Submissions1699
Total Times Completed540
JavaScript Completions218
Python Completions256
Swift Completions85
Total Stars25
% of votes with a positive feedback rating90% of 147
Total "Very Satisfied" Votes127
Total "Somewhat Satisfied" Votes12
Total "Not Satisfied" Votes8
Ad
Contributors
  • JDeBolt Avatar
  • myjinxin2015 Avatar
  • Bubbler Avatar
  • user9644768 Avatar
Ad