User Profile

Collapse

Profile Sidebar

Collapse
morris11
morris11
Last Activity: Jun 26 '08, 06:15 PM
Joined: Mar 22 '08
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • morris11
    started a topic Priority queue based on a sorted linked list
    in Java

    Priority queue based on a sorted linked list

    I want to implement a priority queue based on a sorted linked list. The remove operation on the priority queue should remove the item with a smallest key. Can anybody give me an idea how to do that?
    See more | Go to post

  • morris11
    replied to Circular Linked List
    in Java
    I got the idea.
    Thank you very much...
    See more | Go to post

    Leave a comment:


  • morris11
    started a topic Circular Linked List
    in Java

    Circular Linked List

    I am trying to create a circular list that includes insert() , find() and remove() methodes. also a step() method that moves current along to the next link.
    I still need to display the list by breaking the circle at some arbitrary point to print it on the screen. Does anyone have an idea how to do that?

    Code:
    import javax.swing.JOptionPane;
     public class CLL
    {
    public class Link
    {
    int item=0;
    ...
    See more | Go to post

  • morris11
    replied to ordered array
    in Java
    Thank you for your advice...
    See more | Go to post

    Leave a comment:


  • morris11
    replied to ordered array
    in Java
    Honestly, I didn't develop the code myself , but i understood the find() method how it works, i mean the one i gave and not your suggestion. My problem is that I am not good in java; means i couldn't translate your ideas into code even I understood them ; so please, if it is possible, translate this part of your suggestion into code:
    "you must return variable "lowerBound " in your previous binary search algorithm to know the...
    See more | Go to post

    Leave a comment:


  • morris11
    replied to ordered array
    in Java
    this is what i've done for insert() and delete() methods using linear search:

    public void insert(long value)
    {
    int j;
    for(j=0; j<nElems; j++)
    if (a[j]>value)
    break;
    for(int k=nElems; k>j; k--)
    a[k]= a[k-1];
    a[j] = value;
    nElems++;
    }


    public boolean delete(long value)
    {
    int j = find(value);
    if (j==nElems)
    ...
    See more | Go to post

    Leave a comment:


  • morris11
    replied to ordered array
    in Java
    This is what i've done so far for find() method:

    [CODE=java]public int find(double searchKey)
    {
    int lowerBound = 0;
    int upperBound = nElems-1;
    int curIn;

    while(true)
    {
    curIn = (lowerBound + upperBound ) / 2;
    if(a[curIn]==searchKey)
    return curIn;
    else if(lowerBound > upperBound)...
    See more | Go to post
    Last edited by Ganon11; Mar 22 '08, 01:51 PM. Reason: Please use the [CODE] tags provided.

    Leave a comment:


  • morris11
    started a topic ordered array
    in Java

    ordered array

    I want to write some methods like insert(), delete() and find() in an ordered array using binary search
    See more | Go to post
No activity results to display
Show More
Working...