Új hozzászólás Aktív témák
-
#74220800
törölt tag
Amúgy a feladatom az lenne, hogy saját kezűleg kell implementalni egy priorityqueque-t, minheap struktúrával,
az alábbi interface segitsegevel:/**
* Manages elements within a priority queue. All Elements in this queue must
* implement the Comparable interface. If a element is requested from this data
* structure the smallest one is returned. If there are multiple smallest
* elements, one of them must be returned.
*/
public class PriorityQueue<T extends Comparable<T>> {
/**
* @param maxElements The maximum number of elements this queue can hold.
*/
public PriorityQueue(int maxElements);
/**
* Add e to the queue.
*
* @param e The element which sould be inserted (at the correct position) into the queue.
* @throws IllegalStateException if the queue is already full
*/
public void add(T e) throws IllegalStateException;
/**
* Returns and removes the smallest element in the queue.
*
* @return the smallest element
* @throws IllegalStateException if the queue is empty
*/
public T pop() throws IllegalStateException;
/**
* Return the current number of elements in the queue.
*
* @return the number of elements
*/
public int size();
}Es nem tudom, hogy milyen classot használhatnék e szerint az adatok belső menedzselésére.
A baj az, hogy a beepitett java PriorityQueue is minheapet használ.LinkedList<E> ill. ArrayList<E> szeretnek használni hozza.
Vagy a fenti feladat azt jelenti, hogy a bepitett PriorityQueue-hoz felülirom a pop() es add() metódusokat?
De akkor meg nem tudok indexeket hasznalni, és az algoritmus alapján szerintem mindenképpen olyan kell, ami indexelhető. Nem tudom ...
Új hozzászólás Aktív témák
A topicot kiemeltem. Valaki nem akar egy nyitó hsz-t írni?:))
- Óra topik
- AMD Ryzen 9 / 7 / 5 / 3 5***(X) "Zen 3" (AM4)
- OnePlus: Settle Down, nem megyünk sehova
- TCL LCD és LED TV-k
- Metal topik
- Nem lát hasznot az AI-ból a cégvezetők többsége
- Építő/felújító topik
- Elemlámpa, zseblámpa
- Intel Core i5 / i7 / i9 "Alder Lake-Raptor Lake/Refresh" (LGA1700)
- Battlefield 6
- További aktív témák...
- Akko, Gateron, Haimu x Geon kapcsolók
- Szép! Lenovo ThinkPad X1 Yoga G6 x360 Érintős Hajtogatós Laptop Tab 14" -50% i5-1135G7 16/256 +Toll
- Samsung Galaxy Tab S10 Ultra 256 GB újszerű állapot
- GamerPC RX 9070/7700X/32GB DDR5/1TB M2
- Szép! Lenovo ThinkPad X1 Yoga G6 x360 Érintős Hajtogatós Laptop Tab 14" -50% i5-1135G7 16/256 +Toll
- Bomba ár! HP EliteBook 745 G6 - Ryzen 7 3700U I 16GB I 256SSD I HDMI I 14" FHD I Cam I W10 I Gari!
- TomTom Go 5200 with Wi-Fi navigáció / 12 hó jótállás
- ÁRGARANCIA!Épített KomPhone i5 12400F 32/64GB RAM RTX 5070 12GB GAMER PC termékbeszámítással
- Telefon felvásárlás!! Honor 90 Lite/Honor 90/Honor Magic5 Lite/Honor Magic6 Lite/Honor Magic5 Pro
- Lenovo T450s notebook hibás kijelzővel - 14", i5, 4GB RAM, eu vil.bill, számla, gar
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest
Cég: Central PC számítógép és laptop szerviz - Pécs
Város: Pécs


