




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





String[] members = {"Mary", "John", "Peter"}; for (int i=0; i
public static boolean sameArray(int[ ] a, int[ ] b) { if (a.length != b.length) return false; else { return sameArray (a, b, 0); } } public static boolean sameArray(int[] a, int[] b, int k) { if (k == a.length) return true; else { if (a[k] != b[k]) return false; else return sameArray(a,b,k+1) ; } }
public boolean removeStudent(String name) { for (Integer sectionNum : allSections.keySet()) { Set section = allSections.get(sectionNum); if (section.contains(name)) { section.remove(name); if (section.isEmpty()) { allSections.remove(sectionNum); } return true ; } } return false ; }
public MyLinkedList() { head = null ; }
public void addEnd(T element) { Node newNode = new Node(); newNode.data = element; newNode.next = null ; if (head == null ) { head = newNode; } else { /* Traversing the list / Node curr = head; while (curr.next != null ) curr = curr.next; / Inserting at the end */ curr.next = newNode; } }
public void printReverse() { printReverseAux(head); } public void printReverseAux(Node curr) { if (curr != null) { printReverseAux(curr.next); System. out .println(curr.data); } }