Experiment report of Besti
course:《Program Design & Data Structures》
Class: 1623
Student Name: Wang, Yixiao
Student Number:20162314
Tutor:Mr.Lou、Mr.Wang
Experiment date:2017.9.26
Secret level: Unsecretive
Experiment time:60 minutes
Major/Elective:Major
Experiment order:5
Experiment content
- Linear-list test of Java :Process, Problem.
- Linear-list application of Java :Process, Problem.
- Implement ArrayList(Pseudocode, Productcode, Testcode): Process(Analysis, Design,implement,test),Problem.
- Implement LinkedList (Pseudocode, Productcode, Testcode): Process(Analysis, Design,implement,test),Problem.
- Analyze source code of ArrayList and LinkedList:Process,Skill.
Experiment situation
Exp1 Linear-list test of Java
- It's easy to finish this experiment.
- To start with , import to form a new Linked-list to start the experiment.
- Next , use the method list.add() to ealuation.
- Then , use the for-loop to test the Linked-list.add method respectively.
- Last , export the value of three loops respectively.
Exp2 Linear-list application of Java
- To start with , set a class by using List
to creat alist and blist, make the two lists' size equally. - Next , use the sentence while-if, value alist(i) and blist(j)
- If the alist(i) > blist(j) , then merge the first place with index i+j by bList.get(j)
- Else , take the opposite.
- Then , when the length of alist > i , merge the list with index i+j by alist.get(i)
- while the length of blist > j , do the opposite
- After the loops end , return the result of merging lists.
- Last , write a test with valuing two arraylists by using list.add() and print the result.
Exp3 Implement ArrayList
- To start with , import to form a new Array-list to start the experiment.
- Next , write the index and the first element
- Next , use the method list.add to make the array list.
- Then , output and explain the fist element.
- Then , use the method list.remove to remove a number.
- Next , use the method list.contain to check whether the number is in list right now.
- Then , use the for-loop and leam.iterator to print iter.next() .
- Next , form a new String Array to print string.
- Then , use the list.clear to clear the list number.
- Last , use the method list.isEmpty to check whether the list is empty now.
Exp4 Implement LinkedList
- The whole test is made of three methods:testLinkedListAPIs(),useLinkedListAsLIFO();,useLinkedListAsFIFO();
- Then creat a class to explain this three methods.
- import a new linkedlist
- Next, use list.add to print
- Then, use stack to pop and peek.
- Next, creat a new queue
- Use the method to add and remove ,last print.
Exp5 Analyze source code of ArrayList and LinkedList
>.
Assume when we creat a Linkedlist at the start, there is only a hearder point,as the following picture.
There is a elementA1 insert ahead the header.
Now,insert a element A2 after implementing the code as the following
EntrynewEntry = new Entry (A2, header, header.previous);
//Make newEntry.next point to the header, new Entry point to header.previous(A1)
newEntry.previous.next = newEntry;
newEntry.next.previous = newEntry;
Then, the picture turn to this
Code hosting
PSP5.1(Personal Software Process)
Steps | Time | percent |
---|---|---|
requirement | 45minutes | 16.7% |
design | 50minutes | 18.5% |
coding | 1.5hours | 32.2% |
test | 30minutes | 11.1% |
summary | 55minutes | 19.2% |