Make up after class in the tenth week

20165339 Week 10 in-class test make-up

1. Relevant knowledge points

  • Create a linked list:LinkedList<String> mylist=new LinkedList<String>();
  • Add node:list.add(E obj)
  • Delete node:list.remove(index)
  • Traverse Linked List: (Iterator) Linked list objects use iterator()methods to obtain an Iteratorobject. get(int index)Returns the index-th object in the list with the method.
  • Sort: Sort public static sort(List<E> list)the elements in the linked list in ascending order.
  • Find: int binarySearch(List<T> list, T key, CompareTo<T> c)Use halved to find the same element as key.
  • There is a source code of a class, sort a member variable, let the class implement the Comparable interface, and call Collection.sort(List)
  • If there is no source code of the class, or multiple sorting, create a new class, implement the Comparator interface and call Collection.sort(List, Compatator)

    2. Make up in class

    Data Structure - Sorting

    code link

    Data Structure - Singly Linked List

    code link

    Textbook Code

    first question

    Use the stack structure to output several items of an, where an=2an-1+2an-2, a1=3, a2=8.

Question 2

Store the students' English transcripts in the linked list into a tree set, so that they can be automatically sorted by grades and output the sorting results

Question 3

There are 10 USB sticks with two important properties: price and capacity, write an application, use TreeMap

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325347985&siteId=291194637