Ú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?:))
- Mid tower gèp ház
- 2024-es Lenovo ThinkPad T14 Gen4 laptop, gyári garanciával, eredeti magyar billentyűzettel eladó!
- Makulátlan Iphone 13 Midnigth Black 128 GB 88% 2024.12.23-án vásárolt
- TESTRESZABHATÓ/GARIS/ Ryzen 5 5600/16GB DDR4/RX 6700 XT 12 GB/ 1 TB M.2 SSD/2 TB HDD
- ASUS ROG STRIX G16 Gamer laptop 16" -40% Raptor i9-14900HX 24Mag 16/1TB 240Hz RTX 4070 8GB QHD
- Gamer PC-Számítógép! Csere-Beszámítás! I5 10400F / GTX 1070 8GB / 16GB DDR4 / 512 Nvme SSD
- Lenovo ThinkPad L16 Gen 1 - 16" WUXGA IPS - Ultra 5 135U - 16GB - 512GB - Win11 - 2,5 év gari
- Samsung Galaxy A53 5G 128GB, Kártyafüggetlen, 1 Év Garanciával
- LG 32UQ85V-W / 32" Nano IPS / 4K 3840x2160 / Gyárilag Kalibrált / HDR 400 / USB Type-C 90W
- GYÖNYÖRŰ iPhone 14 Pro Max 128GB Space Black - 1 ÉV GARANCIA -Kártyafüggetlen, MS4332
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest

