Ada yang bisa bantu jelasin ane tentang Binary Search Tree di Java(bukan javascript) ?

untuk kasusnya gini:

Ane mau buat program dimana program ini membaca text dalam sebuah file. textnya ini nanti dihitung perkata oleh programnya. Salah satu ketentuan classnya adalah ini.

1. WordNode class

This class is used to represent an entry in the text file. It will have the following attributes: • a word • a counter that keep track of how many times the word appear in the text file • a list that keeps the line number(s) where the word appears

You need to implement the Comparable interface so that WordNode objects could be compared alphabetically.

Methods that are included in this class: • a constructor that will takes two parameters, ie the word and the line number • getter and setter methods for each attributes • a method getLineNumbers that does not accept any parameter, and return a string containing the line numbers where the word appears • a toString method that will return a string representation in the form: data (3): 3, 5, 6 that is, (frequency): line numbers separated by comma You should invoke the method getLineNumbers in toString. • A method update that takes an integer representing the line number where a word appear. This method updates the line number, as well as increases the frequency of the word by one.

ane bingung sama method update terakhir itu? mohon dibantu bagi yang bisa :D Terima Kasih

avatar yogatanaya
@yogatanaya

10 Kontribusi 2 Poin

Dipost 6 tahun yang lalu

Belum ada Jawaban. Jadi yang pertama Jawaban

Login untuk ikut Jawaban