Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MList-- kinda like SList except the parameters are vars instead of vals, so the list is mutable
- case class MList(var item, var next: MList)
- The MList is basically the same except the header node contains the size of the list which is different.
- ======
- def take(list: MList, n: Int): Unit {
- }
- (5,1,2,3,4,5) take 3
- 5,1 D (2,3,4,5)
- list.item,list.next.item | list.next.next
- (3,1,2,3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement