Doubly Linked List

Create an DoublyLinkedList class, a list whose elements are maintained in sorted order (this means that only comparable objects may be placed in an DoublyLinkedList, notice the generic parameter <E extends Comparable<? super E>> tells the compiler just that). Also note that a DoublyLinkedList may contain duplicate elements. The DoublyLinkedList class is implemented as a doubly-linked list whereas the LList class from our text is implemented as a singly-linked list. To accomplish this you will have to redefine the private Node<E> class to have an extra data field to point to the previous node. The data components of an DoublyLinkedList consist of a firstnode, lastNode, and length and a typical list is shown below.

public class DoublyLinkedList<E extends Comparable<? super E>> implements SortedListInterface<E>{

public interface SortedListInterface<E>{

/** Task: Adds a new entry to its proper position in the list.

* @param newEntry the object to be added as a new entry

* @return true if the addition is successful, or false if not

* DO NOT USE a sort() method here*/

public boolean add(E newEntry);

/** Task: Removes the entry at a given position from the list.

* Entries originally at positions higher than the given

* position are at the next lower position within the list,

* and the list's size is decreased by 1.

* @param givenPosition an integer that indicates the position of

* the entry to be removed; givenPosition >= 1

* and givenPosition <= getLength()

* @return either the entry at position givenPosition, if the removal

* was successful, or null */

public E remove(int givenPosition);

/** Task: Removes anEntry from the list and returns its position back

* to the caller. If anEntry is not found, return -1 indicating

* the item is not found.

* @param anEntry the entry to be removed;

* @return the position of anEntry if the removal

* was successful, or -1 */

public int remove(E anEntry);

 /** Task: Removes all entries from the list. */

public void clear();

/** Task: Retrieves the entry at a given position in the list.

* @param givenPosition an integer that indicates the position of

* the desired entry; givenPosition >= 1

* and givenPosition <= getLength()

* @return a reference to the indicated list entry, if found,

* otherwise returns null */

public E getEntry(int givenPosition);

/** Task: Determines whether the list contains a given entry.

* @param anEntry the object that is the desired entry

* @return true if the list contains anEntry, or false if not */

public boolean contains(E anEntry);

/** Task: Gets the length of the list.

* @return the integer number of entries currently in the list */

public int getLength();

/** Task: Determines whether the list is empty.

* @return true if the list is empty, or false if not */

public boolean isEmpty();

/** Task: Determines whether the list is full.

* @return true if the list is full, or false if not */

public boolean isFull();

/** Task: Displays all entries in the list, one item at a time

* separated by commas in the order in which they occur in the list if
 * smallestToLargest is true, otherwise displays one item at a time in the

* reverse order they appear in the list. */

public void display(boolean smallestToLargest);

} // end SortedListInterface


Egyptian Multiplication and DoublyLinkedList class

The ancient Egyptians knew how to work with fractions but saw beauty in representing fractions as a sum of distinct unit fractions (fractions whose numerator equals 1). For example, the ancient Egyptians would represent the fraction ¾ as

This can be accomplished by starting with an DoublyLinkedList<BigInteger> consisting of three fours [4, 4, 4] which represents ¼ + ¼ + ¼. Note that it is necessary to store only the denominators. The idea is to remove a duplicate integer x from the DoublyLinkedList and replace it by adding the integers x+1 and x(x+1). [Word of warning: you will have to use the methods add() and multiply() from BigInteger]. Why does this process work? The reason is

1/x = 1/(x+1) + 1/[x(x+1)].

Let’s complete this example. By showing the contents of the DoublyLinkedList after each duplicate is removed.

[4, 4, 4] remove 4 add 5 and 20

[4, 4, 5, 20] remove 4 add 5 and 20

[4, 5, 5, 20, 20] remove 5 add 6 and 30

[4, 5, 6, 20, 20, 30] remove 20 add 21 and 420

[4, 5, 6, 20, 21, 30, 420] each entry is distinct

The EgyptianFraction class should have instance variables

 private DoublyLinkedList<BigInteger> representation;

private BigInteger numerator;

private BigInteger denominator;

You will need methods to 
 1) detect duplicate items in the DoublyLinkedList
 2) remove a duplicate from the DoublyLinkedList
 3) print the representation of an Egyptian Fraction,

as well as, a constructor that initializes the DoublyLinkedList based on the inputted fraction.

It should be able to print out horizontally.

Skills: Java

See more: doublylinkedlist, representation of integers, n equals, linked on, linked n, linked it, linked int, java compiler 1.5, int size c, integers and, how to work integers, generic components, data entry work linked in, egyptianfraction, param java, just in time compiler, VOID, remove object, null, linked, java reverse, java complete reference, int, full node, data removal

About the Employer:
( 9 reviews ) pittsburgh, United States

Project ID: #529825

29 freelancers are bidding on average $262 for this job


Hi I'm willing to do this

$250 USD in 2 days
(14 Reviews)

Hello sir, I have over 2 years of experience in [url removed, login to view] job seems very interesting.I can do the job only for $150. Thanks

$250 USD in 2 days
(7 Reviews)

I can do this project. Please check the PM

$250 USD in 1 day
(5 Reviews)

Very interesting "problem". I can provide you DoublyLinkedList and EgyptianFraction class in short term, with methods you demand and fully tested. Best regards from experienced Java developer

$250 USD in 2 days
(1 Review)

I am a MSc student in computer science with 4+ years of Java experience (both using and teaching). I am also experienced with data structures.

$250 USD in 1 day
(12 Reviews)

After I developed an artificial intelligence for my project at Computer Interaction in LISP, I saw Java as a kindergarden kid's toy. So, I am qualified to do your project.

$250 USD in 2 days
(2 Reviews)

hi, I used to work as a research assistant in a computer science department and now I'm working as a java developer. I can complete your project in 1 day.

$250 USD in 1 day
(0 Reviews)

I can do it~

$250 USD in 7 days
(0 Reviews)

I can do it successfully.. I am a scjp, scwcd professional with 4 n half years realtime experience. As I am new for freelancing I want to do it at a lower price 230

$250 USD in 2 days
(0 Reviews)

I am really happy to bid on your project. Please see your PMB for details. Best regards...

$250 USD in 2 days
(0 Reviews)

Hi, Please check PMN.

$250 USD in 3 days
(0 Reviews)

Hello. Please check the PM. Thanks.

$250 USD in 1 day
(0 Reviews)

Bid amount 250$ for Doubly Linked List project which can be completed in 30 days.

$250 USD in 30 days
(0 Reviews)

I am a developer interested in hardcore programming, your requirements are very clear and that is great. Should be able to give you a fully functional implementation according to required specs latest on the third day. More

$250 USD in 3 days
(0 Reviews)

Please check PM.

$250 USD in 7 days
(0 Reviews)

Please check PM

$250 USD in 2 days
(0 Reviews)

Please see PMB. Thanks.

$500 USD in 7 days
(0 Reviews)

It's will be simple.

$250 USD in 2 days
(0 Reviews)

Please check my PM

$350 USD in 0 days
(0 Reviews)

hey .. I am 4th year student computer science major .. I did 8 month coop in RIM as User Interface developer ..and I did 8 month with IBM as java developer .. I implement a lot of algorithm in my school . your link More

$250 USD in 2 days
(0 Reviews)