Search:

Type: Posts; User: dezett

Search: Search took 0.41 seconds.

  1. Replies
    7
    Views
    985

    [SOLVED] Re: Dijkstra's algorithm

    u.equals(x) happens when 'u' gets through all the prevs to the room we wanted and needed to visit.

    u = u.prev; is assigning the previous room to our variable 'u'.

    'x' is a room we needed to...
  2. Replies
    7
    Views
    985

    [SOLVED] Re: Dijkstra's algorithm

    Ok, I will post the code and sorry for my absence from the topic but I had some problems.

    So, this function gives the error:

    public void run(Vertex x)
    {
    this.roomNumber = 0;
    ...
  3. Replies
    7
    Views
    985

    [SOLVED] Re: Dijkstra's algorithm

    Well, I have found my mistake. The problem was in function Relax: I didn't add back the vertex which weight was the smallest of all. Thank you for your reply though.

    //EDIT: Though now I have...
  4. Replies
    7
    Views
    985

    [SOLVED] Dijkstra's algorithm

    Hello once again.
    I wrote a program which uses Dijkstra's algorithm to give us the best weight path through an labyrinth (though every room has 2, 3 or 4 neighbours). Each room has it's weight. We...
  5. Re: Dictionary using Distributed Hash Table and BST Tree

    So: 1. I got it from a friend.
    2. constant 53 is: number of small letters + big letters + space.
    3. 96 is the code of "`" before "a" in the ASCII code.
    4. l is the size of the dictionary.

    I...
  6. Re: Dictionary using Distributed Hash Table and BST Tree

    I think my hash function has some issue.
    It should give me numbers 1-7 and for "g" it gives me 0.

    public static int hash(String key, int l)
    {
    int value = 0;

    for(int j =...
  7. Re: Dictionary using Distributed Hash Table and BST Tree

    That's right. So in BSTs i should just compare strings? No rehash needed?
  8. Re: Dictionary using Distributed Hash Table and BST Tree

    I need to use a Hashtable with an independent connecting which will store Binary Search Trees (words are to be stored in an lexicographical order).
  9. Re: Dictionary using Distributed Hash Table and BST Tree

    I mean: e.g. I get a word with a hashcode 1, so i save it in the BST with the number 1. If i get another word (it's different than the 1st), but it has the same hashcode, I want to save it in the BST...
  10. Re: Dictionary using Distributed Hash Table and BST Tree

    How should i rehash the words with the same hashcode? Creating another rehash method or using hash again(if hash - how?)?
  11. Re: Dictionary using Distributed Hash Table and BST Tree

    I have modified the constructor. Trying to fill the array with the instances.
    DHT(int n)
    {
    bst = new BST[n];

    for(int i = 0; i < n; i++)
    ...
  12. Re: Dictionary using Distributed Hash Table and BST Tree

    return bst[k].insert(x, k);

    variables: x, k, bst array.
    x = a
    k = n
    bst[1 - n] = null

    line 236
    public static class DHT
    {
  13. Re: Dictionary using Distributed Hash Table and BST Tree

    Well, i Can't find such a variable. Though when i was trying to debug, i found that the program has some problems with the DHT constructor. This is what it displayed: Not able to submit breakpoint...
  14. Re: Dictionary using Distributed Hash Table and BST Tree

    Exception in thread "main" java.lang.NullPointerException
    at JavaApplication18$DHT.insert(JavaApplication18.java:244)
    at JavaApplication18.main(JavaApplication18.java:18)
  15. Re: Dictionary using Distributed Hash Table and BST Tree

    The problem is clearly in the insert method of the BST/DHT class. It crashes at the beginning, while passing the variables from DHT insert to BST insert. It doesn't even print anything when I add a...
  16. Re: Dictionary using Distributed Hash Table and BST Tree

    I have corrected the code. Now it has no compiler errors.
    I have added to the code in main:
    while(!"#".equals(s))
    {
    int p = hash(s, n);
    System.out.println(s + " " + n...
  17. Re: Dictionary using Distributed Hash Table and BST Tree

    Well, I did as you told me, but it didn't tell me a thing. When I printed the variables i didn't get any null value. They were good. I did the whole function with the arguments given on the paper and...
  18. Dictionary using Distributed Hash Table and BST Tree

    Hello. I have a problem with my code.
    I have implemented BST Tree as well as DHT but my code doesn't work.
    Here it is:

    import java.util.Scanner;

    public class JavaApplication18
    {
    ...
Results 1 to 18 of 19